Open
Backport upstream security fixes: CVE-2026-15003, CVE-2026-91782, CVE-2026-91781, CVE-2026-90829 #470
Backport upstream security fixes: CVE-2026-15003, CVE-2026-91782, CVE-2026-91781, CVE-2026-90829 #470
Open
weixin_40656384Add on 2 days ago
Total: 5 files changed+398-1
@@ -0,0 +1,102 @@
1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+From: Alan Modra <amodra@gmail.com>
3+Date: Thu, 9 Apr 2026 09:06:27 +0930
4+Subject: [PATCH] PR 34053: Sanity check aux entries in xcoff_link_add_symbols
5+MIME-Version: 1.0
6+Content-Type: text/plain; charset=UTF-8
7+Content-Transfer-Encoding: 8bit
8+ 
9+Backport of upstream commit 23acf2f003f81b2f8d9d1997ea45d822d33d386c
10+("PR 34053 buffer overflow in xcoff_link_add_symbols") to binutils 2.41.
11+ 
12+CVE-2026-15003: A heap-buffer-overflow READ (CWE-125) was found in
13+xcoff_link_add_symbols() in bfd/xcofflink.c. When processing a crafted
14+XCOFF object, an unvalidated n_numaux index caused the linker to read
15+symbol auxiliary entries past the end of the symbol buffer.
16+ 
17+This backport applies the security-relevant changes from the upstream
18+commit. The upstream commit also tidies a large number of unnecessary
19+casts throughout xcofflink.c; those cast cleanups are omitted to keep
20+the diff minimal and avoid merge noise. Specifically, this backport
21+includes:
22+ 
23+ 1. xcoff_link_add_symbols: bounds-check the auxiliary entry at
24+ esym+symesz before bfd_coff_swap_aux_in in the line-number info
25+ path (bfd/xcofflink.c:1478).
26+ 2. xcoff_link_add_symbols: extend the existing "sym.n_numaux == 0"
27+ guard to also reject n_numaux values whose aux entry lies outside
28+ the symbol buffer, via a shared "badaux" error path
29+ (bfd/xcofflink.c:1544).
30+ 3. bfd_xcoff_build_dynamic_sections: extend the BFD_ASSERT to also
31+ check that symesz * sym.n_numaux is within the symbol buffer
32+ (bfd/xcofflink.c:4162). This assertion guards the same aux read
33+ pattern in a different function.
34+ 4. xcoff_link_input_bfd: extend the BFD_ASSERT likewise
35+ (bfd/xcofflink.c:5201). Same pattern in the final link pass.
36+ 
37+Omitted from backport: the upstream commit's cast tidy-up (removal of
38+approximately 60 unnecessary (void *) and (bfd_size_type) casts
39+throughout xcofflink.c). These are cosmetic and not security-relevant.
40+ 
41+The vulnerable code is present in binutils 2.41 (bfd/xcofflink.c:1478,
42+:1544, :4162, :5201); the fix first shipped in the binutils 2.47
43+release.
44+ 
45+References:
46+ https://sourceware.org/bugzilla/show_bug.cgi?id=34053
47+ https://access.redhat.com/security/cve/CVE-2026-15003
48+ NVD: CVE-2026-15003 (pub 2026-07-27, Awaiting Analysis)
49+ 
50+fixes: CVE-2026-15003
51+Signed-off-by: xuehaolin <xuehaolin@uniontech.com>
52+---
53+ bfd/xcofflink.c | 18 +++++++++++++++---
54+ 1 file changed, 15 insertions(+), 3 deletions(-)
55+ 
56+diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
57+--- a/bfd/xcofflink.c
58++++ b/bfd/xcofflink.c
59+@@ -1475,6 +1475,9 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
60+ {
61+ union internal_auxent auxlin;
62+
63++ if (symesz >= (size_t) (esym_end - esym))
64++ goto badaux;
65++
66+ bfd_coff_swap_aux_in (abfd, (void *) (esym + symesz),
67+ sym.n_type, sym.n_sclass,
68+ 0, sym.n_numaux, (void *) &auxlin);
69+@@ -1541,8 +1544,10 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
70+ visibility = sym.n_type & SYM_V_MASK;
71+
72+ /* Pick up the csect auxiliary information. */
73+- if (sym.n_numaux == 0)
74++ if (sym.n_numaux < 1
75++ || sym.n_numaux * symesz >= (size_t) (esym_end - esym))
76+ {
77++ badaux:
78+ _bfd_error_handler
79+ /* xgettext:c-format */
80+ (_("%pB: class %d symbol `%s' has no aux entries"),
81+@@ -4159,7 +4164,8 @@ bfd_xcoff_build_dynamic_sections (bfd *output_bfd,
82+ /* Read in the csect information, if any. */
83+ if (CSECT_SYM_P (sym.n_sclass))
84+ {
85+- BFD_ASSERT (sym.n_numaux > 0);
86++ BFD_ASSERT (sym.n_numaux > 0
87++ && symesz * sym.n_numaux < (size_t) (esymend - esym));
88+ bfd_coff_swap_aux_in (sub, esym + symesz * sym.n_numaux,
89+ sym.n_type, sym.n_sclass,
90+ sym.n_numaux - 1, sym.n_numaux, &aux);
91+@@ -5198,7 +5204,8 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
92+ /* Read in the csect information, if any. */
93+ if (CSECT_SYM_P (isymp->n_sclass))
94+ {
95+- BFD_ASSERT (isymp->n_numaux > 0);
96++ BFD_ASSERT (isymp->n_numaux > 0
97++ && isymesz * isymp->n_numaux < (size_t) (esym_end - esym));
98+ bfd_coff_swap_aux_in (input_bfd,
99+ (void *) (esym + isymesz * isymp->n_numaux),
100+ isymp->n_type, isymp->n_sclass,
101+--
102+2.43.0
@@ -0,0 +1,117 @@
1+From: infra_team <zhaiwenjie1@huawei.com>
2+Date: Wed, 16 Sep 2026 00:38:50 +0800
3+Subject: [PATCH] fix: CVE-2026-90829 - NULL pointer dereference in
4+ bfd_elf_set_group_contents
5+MIME-Version: 1.0
6+Content-Type: text/plain; charset=UTF-8
7+Content-Transfer-Encoding: 8bit
8+ 
9+Backport of community patch from src-openeuler/binutils MR !466
10+(infra_team, 2026-09-16) to binutils 2.41 openEuler-24.03-LTS-Next
11+branch. The upstream binutils project has not yet committed a fix for
12+this issue (sourceware bug 34451 remains UNCONFIRMED at the time of
13+this backport).
14+ 
15+CVE-2026-90829: A NULL pointer dereference was found in
16+bfd_elf_set_group_contents() in bfd/elf.c. A specially crafted SHT_GROUP
17+section whose sh_info is set to -2 (the group signature symbol is
18+global) combined with an abnormal group member chain or an out-of-range
19+symbol index makes bfd_elf_set_group_contents dereference NULL pointers:
20+elf_next_in_group(sec), the elf_sec_group(...) result, igroup->owner,
21+the elf_sym_hashes entry (symndx - extsymoff was not bounds checked) and
22+the hash entry itself. This crashes ld, objcopy and gas while writing
23+out group contents.
24+ 
25+The patch adds defensive NULL checks and a symbol index bounds check at
26+each of these dereference points, setting *failedptr and returning early,
27+in the same style as the existing PR 25699 defensive checks in this
28+function.
29+ 
30+Note: This patch is sourced from the openEuler community (MR !466) and
31+is NOT a direct upstream backport. The upstream bug
32+(https://sourceware.org/bugzilla/show_bug.cgi?id=34451) was
33+UNCONFIRMED as of 2026-11-21. Should upstream provide an official fix,
34+this patch should be reconciled with it.
35+ 
36+The vulnerable code is present in binutils 2.41 (bfd/elf.c:4043-4055).
37+ 
38+References:
39+ https://sourceware.org/bugzilla/show_bug.cgi?id=34451
40+ https://gitcode.com/src-openeuler/binutils/merge_requests/466
41+ NVD: CVE-2026-90829 (pub 2026-09-14, Analyzed)
42+ 
43+fixes: CVE-2026-90829
44+Signed-off-by: infra_team <zhaiwenjie1@huawei.com>
45+Signed-off-by: xuehaolin <xuehaolin@uniontech.com>
46+---
47+ bfd/elf.c | 36 ++++++++++++++++++++++++++++++--
48+ 1 file changed, 33 insertions(+), 9 deletions(-)
49+ 
50+diff --git a/bfd/elf.c b/bfd/elf.c
51+--- a/bfd/elf.c
52++++ b/bfd/elf.c
53+@@ -4034,26 +4034,56 @@
54+ struct bfd_elf_section_data *sec_data;
55+ unsigned long symndx;
56+ unsigned long extsymoff;
57++ unsigned long symcount;
58+ struct elf_link_hash_entry *h;
59+
60+ /* The point of this little dance to the first SHF_GROUP section
61+ then back to the SHT_GROUP section is that this gets us to
62+ the SHT_GROUP in the input object. */
63++ if (elf_next_in_group (sec) == NULL)
64++ {
65++ /* PR 34451: a corrupt input file may contain a SHT_GROUP
66++ section without any group member. */
67++ *failedptr = true;
68++ return;
69++ }
70+ igroup = elf_sec_group (elf_next_in_group (sec));
71++ if (igroup == NULL || igroup->owner == NULL)
72++ {
73++ *failedptr = true;
74++ return;
75++ }
76+ sec_data = elf_section_data (igroup);
77+ symndx = sec_data->this_hdr.sh_info;
78+ extsymoff = 0;
79+- if (!elf_bad_symtab (igroup->owner))
80+- {
81+- Elf_Internal_Shdr *symtab_hdr;
82++ {
83++ Elf_Internal_Shdr *symtab_hdr;
84+
85+- symtab_hdr = &elf_tdata (igroup->owner)->symtab_hdr;
86++ symtab_hdr = &elf_tdata (igroup->owner)->symtab_hdr;
87++ if (!elf_bad_symtab (igroup->owner))
88+ extsymoff = symtab_hdr->sh_info;
89++ symcount = symtab_hdr->sh_size
90++ / get_elf_backend_data (igroup->owner)->s->sizeof_sym;
91++ }
92++ if (symndx < extsymoff
93++ || symndx >= symcount
94++ || elf_sym_hashes (igroup->owner) == NULL)
95++ {
96++ /* PR 34451: the group signature symbol index is out of
97++ range for the symbol table. */
98++ *failedptr = true;
99++ return;
100+ }
101+ h = elf_sym_hashes (igroup->owner)[symndx - extsymoff];
102+- while (h->root.type == bfd_link_hash_indirect
103+- || h->root.type == bfd_link_hash_warning)
104++ while (h != NULL
105++ && (h->root.type == bfd_link_hash_indirect
106++ || h->root.type == bfd_link_hash_warning))
107+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
108++ if (h == NULL)
109++ {
110++ *failedptr = true;
111++ return;
112++ }
113+
114+ elf_section_data (sec)->this_hdr.sh_info = h->indx;
115+ }
116+--
117+2.43.0
@@ -0,0 +1,54 @@
1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+From: H.J. Lu <hjl.tools@gmail.com>
3+Date: Thu, 30 Jul 2026 15:47:05 +0800
4+Subject: [PATCH] PR ld/34449: Return SHN_COMMON on non-ELF input in
5+ elf_x86_64_common_section_index
6+MIME-Version: 1.0
7+Content-Type: text/plain; charset=UTF-8
8+Content-Transfer-Encoding: 8bit
9+ 
10+Backport of upstream commit 7322e9bc30cb282575a701c307851fd3d66fee68
11+("x86-64: Return SHN_COMMON on non-ELF input") to binutils 2.41.
12+ 
13+CVE-2026-91781: elf_x86_64_common_section_index() in bfd/elf64-x86-64.c
14+dereferences elf_section_flags(sec) unconditionally. When the input BFD
15+is non-ELF (e.g. PE/x86-64), elf_section_flags() reads from a union that
16+is only valid for ELF sections, leading to a NULL-pointer dereference /
17+segfault in the linker while processing common symbol section indexes.
18+ 
19+The upstream fix adds a flavour guard: return SHN_COMMON early when the
20+section owner is not an ELF flavour, matching the behaviour of
21+elf_x86_64_common_definition(). The linker then gets an assertion at
22+bfd/coffgen.c:575 instead of a segfault.
23+ 
24+The vulnerable code is present in binutils 2.41
25+(bfd/elf64-x86-64.c:5245); the fix first shipped in the binutils 2.48
26+release.
27+ 
28+References:
29+ https://sourceware.org/bugzilla/show_bug.cgi?id=34449
30+ https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=7322e9bc30cb282575a701c307851fd3d66fee68
31+ https://access.redhat.com/security/cve/CVE-2026-91781
32+ NVD: CVE-2026-91781 (published 2026-09-15, Analyzed, CVSS 3.3 Low)
33+ 
34+fixes: CVE-2026-91781
35+Signed-off-by: xuehaolin <xuehaolin@uniontech.com>
36+---
37+ bfd/elf64-x86-64.c | 3 ++-
38+ 1 file changed, 2 insertions(+), 1 deletion(-)
39+ 
40+diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
41+--- a/bfd/elf64-x86-64.c
42++++ b/bfd/elf64-x86-64.c
43+@@ -5242,7 +5242,8 @@ elf_x86_64_common_definition (Elf_Internal_Sym *sym)
44+ static unsigned int
45+ elf_x86_64_common_section_index (asection *sec)
46+ {
47+- if ((elf_section_flags (sec) & SHF_X86_64_LARGE) == 0)
48++ if (bfd_get_flavour (sec->owner) != bfd_target_elf_flavour
49++ || (elf_section_flags (sec) & SHF_X86_64_LARGE) == 0)
50+ return SHN_COMMON;
51+ else
52+ return SHN_X86_64_LCOMMON;
53+--
54+2.43.0
@@ -0,0 +1,70 @@
1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+From: H.J. Lu <hjl.tools@gmail.com>
3+Date: Sat, 1 Aug 2026 11:23:39 +0800
4+Subject: [PATCH] PR ld/34448: Check if needed dynamic relocation section is
5+ created
6+MIME-Version: 1.0
7+Content-Type: text/plain; charset=UTF-8
8+Content-Transfer-Encoding: 8bit
9+ 
10+Backport of upstream commit 0a84e5602163e9f95a6f137ced28aff0507ce790
11+("x86: Check if needed dynamic relocation section is created") to
12+binutils 2.41.
13+ 
14+CVE-2026-91782: A NULL-pointer dereference (DoS, SEGV) was found in
15+_bfd_x86_elf_late_size_sections() / elf_x86_allocate_dynrelocs() in
16+bfd/elfxx-x86.c when processing malformed dynamic relocations.
17+Since elf_link_read_relocs_from_section aborts for a bad relocation,
18+further relocations are not processed and the needed dynamic relocation
19+section is never created, leaving the sreloc pointer NULL. Subsequent
20+dereference of srel crashed the linker.
21+ 
22+This backport adds a NULL check on srel with an error message and
23+"continue", matching the upstream fix. It prevents the specific
24+NULL-deref crash tracked by CVE-2026-91782 / PR ld/34448.
25+ 
26+The full upstream fix for PR ld/34448 spans four commits (the remaining
27+three add x86 GOT/PLT/TLS relocation validation in elf32-i386.c,
28+elf64-x86-64.c, elfxx-x86.c and elfxx-x86.h). Those are larger,
29+multi-file hardening changes deferred to a follow-up; this minimal
30+patch addresses the crash vector reported in the CVE.
31+ 
32+The vulnerable code is present in binutils 2.41 (bfd/elfxx-x86.c:2303);
33+the fix first shipped in the binutils 2.47 release.
34+ 
35+References:
36+ https://sourceware.org/bugzilla/show_bug.cgi?id=34448
37+ https://access.redhat.com/security/cve/CVE-2026-91782
38+ NVD: CVE-2026-91782 (published 2026-09-15, Analyzed)
39+ 
40+fixes: CVE-2026-91782
41+Signed-off-by: xuehaolin <xuehaolin@uniontech.com>
42+---
43+ bfd/elfxx-x86.c | 13 +++++++++++++
44+ 1 file changed, 13 insertions(+)
45+ 
46+diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
47+--- a/bfd/elfxx-x86.c
48++++ b/bfd/elfxx-x86.c
49+@@ -2301,6 +2301,19 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
50+ else if (p->count != 0)
51+ {
52+ srel = elf_section_data (p->sec)->sreloc;
53++ if (!srel)
54++ {
55++ /* NB: Since elf_link_read_relocs_from_section
56++ aborts for bad relocation, further relocations
57++ won't be processed and needed dynamic relocation
58++ section won't be created afterwards. */
59++ _bfd_error_handler
60++ /* xgettext:c-format */
61++ (_("%pB: dynamic relocation section is needed "
62++ "for section `%pA'"),
63++ p->sec->owner, p->sec);
64++ continue;
65++ }
66+ srel->size += p->count * htab->sizeof_reloc;
67+ if ((p->sec->output_section->flags & SEC_READONLY) != 0
68+ && (info->flags & DF_TEXTREL) == 0)
69+--
70+2.43.0
@@ -2,7 +2,7 @@
2Summary: A GNU collection of binary utilities2Summary: A GNU collection of binary utilities
3Name: binutils%{?_with_debug:-debug}3Name: binutils%{?_with_debug:-debug}
4Version: 2.414Version: 2.41
5-Release: 305+Release: 31
6License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later6License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later
7URL: https://sourceware.org/binutils7URL: https://sourceware.org/binutils
8 8 
@@ -447,6 +447,37 @@ Patch5031: backport-CVE-2025-11412-PR-33452-SEGV-in-bfd_elf_gc_record_vtentry.pa
447# Lifetime: Fixed in 2.46447# Lifetime: Fixed in 2.46
448Patch5032: backport-CVE-2026-3441-CVE-2026-3442.patch448Patch5032: backport-CVE-2026-3441-CVE-2026-3442.patch
449 449 
450+# Purpose: CVE-2026-15003 heap-buffer-overflow read in xcoff_link_add_symbols
451+# Lifetime: Fixed in 2.47 (upstream commit 23acf2f003f8)
452+# Note: PARTIAL backport. Upstream commit 23acf2f003f8 ("PR 34053 buffer
453+# overflow in xcoff_link_add_symbols") has three logical parts:
454+# (1) two sanity checks in xcoff_link_add_symbols (security-relevant
455+# aux-entry bounds checks) -- PORTED;
456+# (2) extends the same assertion to later functions
457+# bfd_xcoff_build_dynamic_sections and xcoff_link_input_bfd -- PORTED;
458+# (3) unnecessary-cast cleanup throughout xcofflink.c -- OMITTED.
459+# (3) is cosmetic, not security-relevant. CVE-2026-15003 crash vector
460+# and the equivalent assertion guards in later functions are addressed.
461+Patch5036: backport-CVE-2026-15003-PR-34053-xcoff-aux-bounds.patch
462+ 
463+# Purpose: CVE-2026-91782 NULL-pointer deref in _bfd_x86_elf_size_dynamic_sections
464+# Lifetime: Fixed in 2.47 (upstream commit 0a84e5602163)
465+# Note: PARTIAL backport. Upstream PR ld/34448 fix spans 4 commits; this
466+# patch only ports the srel NULL guard (1/4). The remaining 3 add
467+# x86 GOT/PLT/TLS relocation validation across elf32-i386.c,
468+# elf64-x86-64.c, elfxx-x86.c and elfxx-x86.h (multi-file hardening,
469+# deferred). CVE-2026-91782 crash vector is addressed; full PR
470+# ld/34448 hardening closure pending the remaining 3 commits.
471+Patch5037: backport-CVE-2026-91782-PR-34448-x86-sreloc-null-check.patch
472+ 
473+# Purpose: CVE-2026-91781 NULL-pointer deref in elf_x86_64_common_section_index
474+# Lifetime: Fixed in 2.48 (upstream commit 7322e9bc30cb)
475+Patch5038: backport-CVE-2026-91781-PR-34449-x86-64-common-section-index.patch
476+ 
477+# Purpose: CVE-2026-90829 NULL-pointer deref in bfd_elf_set_group_contents
478+# Lifetime: Upstream UNCONFIRMED (bug 34451); community patch from MR !466
479+Patch5039: backport-CVE-2026-90829-PR-34451-elf-group-null-checks.patch
480+ 
450#----------------------------------------------------------------------------481#----------------------------------------------------------------------------
451 482 
452Provides: bundled(libiberty)483Provides: bundled(libiberty)
@@ -1461,6 +1492,29 @@ exit 0
1461 1492 
1462#----------------------------------------------------------------------------1493#----------------------------------------------------------------------------
1463%changelog1494%changelog
1495+* Sat Nov 21 2026 xuehaolin <xuehaolin@uniontech.com> - 2.41-31
1496+- Fix CVE-2026-15003: heap-buffer-overflow read in xcoff_link_add_symbols
1497+ (PR 34053, upstream commit 23acf2f003f8; PARTIAL backport -- ports the
1498+ two security sanity checks for XCOFF aux entries AND the extended
1499+ BFD_ASSERT in bfd_xcoff_build_dynamic_sections and xcoff_link_input_bfd;
1500+ OMITS the unnecessary-cast cleanup. Crash vector and assertion guards
1501+ addressed. Verification level: compile-level)
1502+- Fix CVE-2026-91782: NULL-pointer deref in _bfd_x86_elf_size_dynamic_sections
1503+ (PR ld/34448, upstream commit 0a84e5602163; PARTIAL backport -- ports 1 of
1504+ 4 upstream commits (the srel NULL guard). Remaining 3 add x86 GOT/PLT/TLS
1505+ relocation validation in elf32-i386.c, elf64-x86-64.c, elfxx-x86.c,
1506+ elfxx-x86.h, deferred. CVE-2026-91782 crash vector addressed; full PR
1507+ ld/34448 hardening closure pending the remaining 3 commits. CVE closure
1508+ to be re-reviewed after the remaining commits land. Verification level:
1509+ compile-level)
1510+- Fix CVE-2026-91781: NULL-pointer deref in elf_x86_64_common_section_index
1511+ (PR ld/34449, upstream commit 7322e9bc30cb; full backport of the 2-line
1512+ flavour guard. Verification level: compile-level)
1513+- Fix CVE-2026-90829: NULL-pointer deref in bfd_elf_set_group_contents
1514+ (PR 34451, upstream UNCONFIRMED; community patch from openEuler MR !466
1515+ by infra_team. Adds defensive NULL checks and symbol index bounds check.
1516+ Verification level: compile-level)
1517+ 
1464* Thu Apr 09 2026 Peng Fan <fanpeng@loongson.cn> - 2.41-301518* Thu Apr 09 2026 Peng Fan <fanpeng@loongson.cn> - 2.41-30
1465- LoongArch: sync fix from upstream1519- LoongArch: sync fix from upstream
1466 1520