summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepesh Varatharajan <Deepesh.Varatharajan@windriver.com>2025-07-24 03:31:53 -0700
committerSteve Sakoman <steve@sakoman.com>2025-07-29 07:59:52 -0700
commit76f88baf019b612109670938047c6840e15083b1 (patch)
tree4e1bf17b0e68d3e73f5160b3c95062f4d5f4137c
parentb162dfb4920a6a18a2ff0a8cbfcfe89b5111763b (diff)
downloadpoky-76f88baf019b612109670938047c6840e15083b1.tar.gz
binutils: Fix CVE-2025-7545
objcopy: Don't extend the output section size Since the output section contents are copied from the input, don't extend the output section size beyond the input section size. Backport a patch from upstream to fix CVE-2025-7545 Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944] (From OE-Core rev: 128e40c39d8eafdd32fea71b902b38801afec202) Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.42.inc1
-rw-r--r--meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch39
2 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.42.inc b/meta/recipes-devtools/binutils/binutils-2.42.inc
index a3ad655dbe..fb34ea9763 100644
--- a/meta/recipes-devtools/binutils/binutils-2.42.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.42.inc
@@ -54,5 +54,6 @@ SRC_URI = "\
54 file://0022-CVE-2025-5245.patch \ 54 file://0022-CVE-2025-5245.patch \
55 file://0022-CVE-2025-5244.patch \ 55 file://0022-CVE-2025-5244.patch \
56 file://0023-CVE-2025-7546.patch \ 56 file://0023-CVE-2025-7546.patch \
57 file://0023-CVE-2025-7545.patch \
57" 58"
58S = "${WORKDIR}/git" 59S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch b/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch
new file mode 100644
index 0000000000..de132f74fc
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch
@@ -0,0 +1,39 @@
1From: "H.J. Lu" <hjl.tools@gmail.com>
2Date: Sat, 21 Jun 2025 06:36:56 +0800
3
4Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944]
5CVE: CVE-2025-7545
6
7Since the output section contents are copied from the input, don't
8extend the output section size beyond the input section size.
9
10 PR binutils/33049
11 * objcopy.c (copy_section): Don't extend the output section
12 size beyond the input section size.
13
14Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
15
16diff --git a/binutils/objcopy.c b/binutils/objcopy.c
17index a85d2620..18cd1bfd 100644
18--- a/binutils/objcopy.c
19+++ b/binutils/objcopy.c
20@@ -4547,6 +4547,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
21 char *to = (char *) memhunk;
22 char *end = (char *) memhunk + size;
23 int i;
24+ bfd_size_type memhunk_size = size;
25
26 /* If the section address is not exactly divisible by the interleave,
27 then we must bias the from address. If the copy_byte is less than
28@@ -4566,6 +4567,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
29 }
30
31 size = (size + interleave - 1 - copy_byte) / interleave * copy_width;
32+
33+ /* Don't extend the output section size. */
34+ if (size > memhunk_size)
35+ size = memhunk_size;
36+
37 osection->lma /= interleave;
38 if (copy_byte < extra)
39 osection->lma++;