summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYash Shinde <Yash.Shinde@windriver.com>2025-07-17 05:03:04 -0700
committerSteve Sakoman <steve@sakoman.com>2025-07-29 07:59:52 -0700
commitb162dfb4920a6a18a2ff0a8cbfcfe89b5111763b (patch)
tree58c27f6409d0bcbd1ca4145e7335a253d791a2fd
parent6269788fef6219c88ef6fdc58ad4724597b29da8 (diff)
downloadpoky-b162dfb4920a6a18a2ff0a8cbfcfe89b5111763b.tar.gz
binutils: Fix CVE-2025-7546
Report corrupted group section instead of trying to recover. CVE: CVE-2025-7546 Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41461010eb7c79fee7a9d5f6209accdaac66cc6b] PR 33050 [https://sourceware.org/bugzilla/show_bug.cgi?id=33050] (From OE-Core rev: 3a54f11b9462905e103e13161a77ef681f14dc92) Signed-off-by: Yash Shinde <Yash.Shinde@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-7546.patch58
2 files changed, 59 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.42.inc b/meta/recipes-devtools/binutils/binutils-2.42.inc
index 9471e6accd..a3ad655dbe 100644
--- a/meta/recipes-devtools/binutils/binutils-2.42.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.42.inc
@@ -53,5 +53,6 @@ SRC_URI = "\
53 file://CVE-2025-1179.patch \ 53 file://CVE-2025-1179.patch \
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" 57"
57S = "${WORKDIR}/git" 58S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7546.patch b/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7546.patch
new file mode 100644
index 0000000000..23c38091a2
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7546.patch
@@ -0,0 +1,58 @@
1From 41461010eb7c79fee7a9d5f6209accdaac66cc6b Mon Sep 17 00:00:00 2001
2From: "H.J. Lu" <hjl.tools@gmail.com>
3Date: Sat, 21 Jun 2025 06:52:00 +0800
4Subject: [PATCH] elf: Report corrupted group section
5
6Report corrupted group section instead of trying to recover.
7
8 PR binutils/33050
9 * elf.c (bfd_elf_set_group_contents): Report corrupted group
10 section.
11
12Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41461010eb7c79fee7a9d5f6209accdaac66cc6b]
13CVE: CVE-2025-7546
14
15Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
16Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
17---
18 bfd/elf.c | 23 ++++++++++-------------
19 1 file changed, 10 insertions(+), 13 deletions(-)
20
21diff --git a/bfd/elf.c b/bfd/elf.c
22index 14ce15c7254..ee894eb05f2 100644
23--- a/bfd/elf.c
24+++ b/bfd/elf.c
25@@ -3971,20 +3971,17 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
26 break;
27 }
28
29- /* We should always get here with loc == sec->contents + 4, but it is
30- possible to craft bogus SHT_GROUP sections that will cause segfaults
31- in objcopy without checking loc here and in the loop above. */
32- if (loc == sec->contents)
33- BFD_ASSERT (0);
34- else
35+ /* We should always get here with loc == sec->contents + 4. Return
36+ an error for bogus SHT_GROUP sections. */
37+ loc -= 4;
38+ if (loc != sec->contents)
39 {
40- loc -= 4;
41- if (loc != sec->contents)
42- {
43- BFD_ASSERT (0);
44- memset (sec->contents + 4, 0, loc - sec->contents);
45- loc = sec->contents;
46- }
47+ /* xgettext:c-format */
48+ _bfd_error_handler (_("%pB: corrupted group section: `%pA'"),
49+ abfd, sec);
50+ bfd_set_error (bfd_error_bad_value);
51+ *failedptr = true;
52+ return;
53 }
54
55 H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
56--
572.43.5
58