Skip to content

Commit b7fe0ad

Browse files
[Medium] Patch gdb for CVE-2025-7546 (microsoft#14349)
1 parent 5b28549 commit b7fe0ad

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

SPECS/gdb/CVE-2025-7546.patch

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
From 41461010eb7c79fee7a9d5f6209accdaac66cc6b Mon Sep 17 00:00:00 2001
2+
From: "H.J. Lu" <[email protected]>
3+
Date: Sat, 21 Jun 2025 06:52:00 +0800
4+
Subject: [PATCH] elf: Report corrupted group section
5+
6+
Report 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+
12+
Signed-off-by: H.J. Lu <[email protected]>
13+
14+
Upstream patch reference: https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=41461010eb7c79fee7a9d5f6209accdaac66cc6b
15+
---
16+
bfd/elf.c | 23 ++++++++++-------------
17+
1 file changed, 10 insertions(+), 13 deletions(-)
18+
19+
diff --git a/bfd/elf.c b/bfd/elf.c
20+
index 14ce15c7254..ee894eb05f2 100644
21+
--- a/bfd/elf.c
22+
+++ b/bfd/elf.c
23+
@@ -3971,20 +3971,17 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
24+
break;
25+
}
26+
27+
- /* We should always get here with loc == sec->contents + 4, but it is
28+
- possible to craft bogus SHT_GROUP sections that will cause segfaults
29+
- in objcopy without checking loc here and in the loop above. */
30+
- if (loc == sec->contents)
31+
- BFD_ASSERT (0);
32+
- else
33+
+ /* We should always get here with loc == sec->contents + 4. Return
34+
+ an error for bogus SHT_GROUP sections. */
35+
+ loc -= 4;
36+
+ if (loc != sec->contents)
37+
{
38+
- loc -= 4;
39+
- if (loc != sec->contents)
40+
- {
41+
- BFD_ASSERT (0);
42+
- memset (sec->contents + 4, 0, loc - sec->contents);
43+
- loc = sec->contents;
44+
- }
45+
+ /* xgettext:c-format */
46+
+ _bfd_error_handler (_("%pB: corrupted group section: `%pA'"),
47+
+ abfd, sec);
48+
+ bfd_set_error (bfd_error_bad_value);
49+
+ *failedptr = true;
50+
+ return;
51+
}
52+
53+
H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
54+
--
55+
2.43.5
56+

SPECS/gdb/gdb.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: C debugger
22
Name: gdb
33
Version: 13.2
4-
Release: 4%{?dist}
4+
Release: 5%{?dist}
55
License: GPLv2+
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -11,6 +11,7 @@ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
1111
Patch0: CVE-2023-39128.patch
1212
Patch1: CVE-2023-39129.patch
1313
Patch2: CVE-2023-39130.patch
14+
Patch3: CVE-2025-7546.patch
1415
BuildRequires: expat-devel
1516
BuildRequires: gcc-c++
1617
BuildRequires: gcc-gfortran
@@ -104,6 +105,9 @@ make check TESTS='gdb.base/default.exp'
104105
%{_mandir}/*/*
105106

106107
%changelog
108+
* Fri Jul 18 2025 Akhila Guruju <[email protected]> - 13.2-5
109+
- Patch CVE-2025-7546
110+
107111
* Mon Feb 03 2025 Andrew Phelps <[email protected]> - 13.2-4
108112
- Enable cross-debugging on all supported targets
109113

0 commit comments

Comments
 (0)