Skip to content

Commit 26ef636

Browse files
azurelinux-securityKanishk-Bansalarchana25-ms
authored
[AutoPR- Security] Patch gdb for CVE-2025-11083, CVE-2025-11082 [MEDIUM] (microsoft#14784)
Co-authored-by: Kanishk Bansal <[email protected]> Co-authored-by: Archana Shettigar <[email protected]>
1 parent 3ca8a2a commit 26ef636

File tree

3 files changed

+137
-2
lines changed

3 files changed

+137
-2
lines changed

SPECS/gdb/CVE-2025-11082.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 5a6b1beedd6202e5c87e7702aca54dc6871a3f9e Mon Sep 17 00:00:00 2001
2+
From: "H.J. Lu" <[email protected]>
3+
Date: Mon, 22 Sep 2025 15:20:34 +0800
4+
Subject: [PATCH] elf: Don't read beyond .eh_frame section size
5+
6+
PR ld/33464
7+
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't read beyond
8+
.eh_frame section size.
9+
10+
Signed-off-by: H.J. Lu <[email protected]>
11+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
12+
Upstream-reference: https://github.com/bminor/binutils-gdb/commit/ea1a0737c7692737a644af0486b71e4a392cbca8.patch
13+
---
14+
bfd/elf-eh-frame.c | 8 ++++++--
15+
1 file changed, 6 insertions(+), 2 deletions(-)
16+
17+
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
18+
index 6ce6d22..f1f6b46 100644
19+
--- a/bfd/elf-eh-frame.c
20+
+++ b/bfd/elf-eh-frame.c
21+
@@ -733,6 +733,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
22+
if (hdr_id == 0)
23+
{
24+
unsigned int initial_insn_length;
25+
+ char *null_byte;
26+
27+
/* CIE */
28+
this_inf->cie = 1;
29+
@@ -749,10 +750,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
30+
REQUIRE (cie->version == 1
31+
|| cie->version == 3
32+
|| cie->version == 4);
33+
- REQUIRE (strlen ((char *) buf) < sizeof (cie->augmentation));
34+
+ null_byte = memchr ((char *) buf, 0, end - buf);
35+
+ REQUIRE (null_byte != NULL);
36+
+ REQUIRE ((size_t) (null_byte - (char *) buf)
37+
+ < sizeof (cie->augmentation));
38+
39+
strcpy (cie->augmentation, (char *) buf);
40+
- buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1;
41+
+ buf = (bfd_byte *) null_byte + 1;
42+
this_inf->u.cie.aug_str_len = buf - start - 1;
43+
ENSURE_NO_RELOCS (buf);
44+
if (buf[0] == 'e' && buf[1] == 'h')
45+
--
46+
2.45.4
47+

SPECS/gdb/CVE-2025-11083.patch

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
From 9ae7d6bebe993a09b3b696ab5186d0d4ee470a8c Mon Sep 17 00:00:00 2001
2+
From: "H.J. Lu" <[email protected]>
3+
Date: Thu, 18 Sep 2025 16:59:25 -0700
4+
Subject: [PATCH] elf: Don't match corrupt section header in linker input
5+
6+
Don't swap in nor match corrupt section header in linker input to avoid
7+
linker crash later.
8+
9+
PR ld/33457
10+
* elfcode.h (elf_swap_shdr_in): Changed to return bool. Return
11+
false for corrupt section header in linker input.
12+
(elf_object_p): Reject if elf_swap_shdr_in returns false.
13+
14+
Signed-off-by: H.J. Lu <[email protected]>
15+
Signed-off-by: Azure Linux Security Servicing Account <[email protected]>
16+
Upstream-reference: AI Backport of https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=9ca499644a21ceb3f946d1c179c38a83be084490
17+
18+
---
19+
bfd/elfcode.h | 16 ++++++++++------
20+
1 file changed, 10 insertions(+), 6 deletions(-)
21+
22+
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
23+
index 7eb27c2..0781745 100644
24+
--- a/bfd/elfcode.h
25+
+++ b/bfd/elfcode.h
26+
@@ -298,7 +298,7 @@ elf_swap_ehdr_out (bfd *abfd,
27+
/* Translate an ELF section header table entry in external format into an
28+
ELF section header table entry in internal format. */
29+
30+
-static void
31+
+static bool
32+
elf_swap_shdr_in (bfd *abfd,
33+
const Elf_External_Shdr *src,
34+
Elf_Internal_Shdr *dst)
35+
@@ -325,9 +325,12 @@ elf_swap_shdr_in (bfd *abfd,
36+
&& ((ufile_ptr) dst->sh_offset > filesize
37+
|| dst->sh_size > filesize - dst->sh_offset))
38+
{
39+
- abfd->read_only = 1;
40+
_bfd_error_handler (_("warning: %pB has a section "
41+
"extending past end of file"), abfd);
42+
+ /* PR ld/33457: Don't match corrupt section header. */
43+
+ if (abfd->is_linker_input)
44+
+ return false;
45+
+ abfd->read_only = 1;
46+
}
47+
}
48+
dst->sh_link = H_GET_32 (abfd, src->sh_link);
49+
@@ -336,6 +339,7 @@ elf_swap_shdr_in (bfd *abfd,
50+
dst->sh_entsize = H_GET_WORD (abfd, src->sh_entsize);
51+
dst->bfd_section = NULL;
52+
dst->contents = NULL;
53+
+ return true;
54+
}
55+
56+
/* Translate an ELF section header table entry in internal format into an
57+
@@ -628,9 +632,9 @@ elf_object_p (bfd *abfd)
58+
59+
/* Read the first section header at index 0, and convert to internal
60+
form. */
61+
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
62+
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)
63+
+ || !elf_swap_shdr_in (abfd, &x_shdr, &i_shdr))
64+
goto got_no_match;
65+
- elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
66+
67+
/* If the section count is zero, the actual count is in the first
68+
section header. */
69+
@@ -716,9 +720,9 @@ elf_object_p (bfd *abfd)
70+
to internal form. */
71+
for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
72+
{
73+
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
74+
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)
75+
+ || !elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex))
76+
goto got_no_match;
77+
- elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
78+
79+
/* Sanity check sh_link and sh_info. */
80+
if (i_shdrp[shindex].sh_link >= num_sec)
81+
--
82+
2.45.4
83+

SPECS/gdb/gdb.spec

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: C debugger
22
Name: gdb
33
Version: 11.2
4-
Release: 7%{?dist}
4+
Release: 8%{?dist}
55
License: GPLv2+
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -18,6 +18,8 @@ Patch6: CVE-2022-48065.patch
1818
Patch7: CVE-2022-47673.patch
1919
Patch8: CVE-2022-47696.patch
2020
Patch9: CVE-2025-7546.patch
21+
Patch10: CVE-2025-11082.patch
22+
Patch11: CVE-2025-11083.patch
2123
BuildRequires: expat-devel
2224
BuildRequires: gcc-c++
2325
BuildRequires: gcc-gfortran
@@ -27,7 +29,7 @@ BuildRequires: python3-libs
2729
BuildRequires: readline-devel
2830
BuildRequires: xz-devel
2931
BuildRequires: zlib-devel
30-
%if %{with_check}
32+
%if 0%{?with_check}
3133
BuildRequires: dejagnu
3234
BuildRequires: systemtap-sdt-devel
3335
%endif
@@ -102,6 +104,9 @@ rm -rvf libctf/testsuite
102104
%{_mandir}/*/*
103105

104106
%changelog
107+
* Fri Oct 03 2025 Azure Linux Security Servicing Account <[email protected]> - 11.2-8
108+
- Patch for CVE-2025-11083, CVE-2025-11082
109+
105110
* Fri Jul 18 2025 Akhila Guruju <[email protected]> - 11.2-7
106111
- Patch CVE-2025-7546
107112
- Fix package tests

0 commit comments

Comments
 (0)