summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepesh Varatharajan <Deepesh.Varatharajan@windriver.com>2025-07-17 04:35:29 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-07-21 23:00:18 +0100
commit5004d1075ac31d9ebd0e6e032b03160bb7cfc633 (patch)
tree3683a10cd2e69aea9f7bd7cd5345d333ab960d7d
parentfe4e74cbe94d0b7d17ab518142e02bd94a864a34 (diff)
downloadpoky-5004d1075ac31d9ebd0e6e032b03160bb7cfc633.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: 3af3d09684caddb4c4dfd45a30e3721f8f6140e4) Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.44.inc1
-rw-r--r--meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch39
2 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.44.inc b/meta/recipes-devtools/binutils/binutils-2.44.inc
index 10a4d2c92a..3313e011bf 100644
--- a/meta/recipes-devtools/binutils/binutils-2.44.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.44.inc
@@ -44,4 +44,5 @@ SRC_URI = "\
44 file://0019-CVE-2025-5244.patch \ 44 file://0019-CVE-2025-5244.patch \
45 file://0019-CVE-2025-3198.patch \ 45 file://0019-CVE-2025-3198.patch \
46 file://0020-CVE-2025-7546.patch \ 46 file://0020-CVE-2025-7546.patch \
47 file://0020-CVE-2025-7545.patch \
47" 48"
diff --git a/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch b/meta/recipes-devtools/binutils/binutils/0020-CVE-2025-7545.patch
new file mode 100644
index 0000000000..062d6721b6
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0020-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 e2e6bd7e..3cbb3977 100644
18--- a/binutils/objcopy.c
19+++ b/binutils/objcopy.c
20@@ -4634,6 +4634,7 @@ copy_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
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@@ -4653,6 +4654,11 @@ copy_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
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++;