Skip to content

Commit cec561a

Browse files
[Low] patch elfutils for CVE-2025-1352 (#13905)
1 parent 825c141 commit cec561a

6 files changed

Lines changed: 164 additions & 35 deletions

File tree

SPECS/elfutils/CVE-2025-1352.patch

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
From 1b6211c6fe3e85b4415ae22d7e97467182a5bdc4 Mon Sep 17 00:00:00 2001
2+
From: dj_palli <v-dpalli@microsoft.com>
3+
Date: Wed, 28 May 2025 11:13:05 +0000
4+
Subject: [PATCH] Address CVE-2025-1352
5+
6+
Upstream patch URL: https://sourceware.org/cgit/elfutils/commit/?id=2636426a091bd6c6f7f02e49ab20d4cdc6bfc753
7+
8+
---
9+
libdw/dwarf_getabbrev.c | 12 ++++--------
10+
libdw/dwarf_offabbrev.c | 10 +++++++---
11+
libdw/dwarf_tag.c | 3 +--
12+
libdw/libdw.h | 4 +++-
13+
libdw/libdwP.h | 3 +--
14+
5 files changed, 16 insertions(+), 16 deletions(-)
15+
16+
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
17+
index 5b02333..d9a6c02 100644
18+
--- a/libdw/dwarf_getabbrev.c
19+
+++ b/libdw/dwarf_getabbrev.c
20+
@@ -1,5 +1,6 @@
21+
/* Get abbreviation at given offset.
22+
Copyright (C) 2003, 2004, 2005, 2006, 2014, 2017 Red Hat, Inc.
23+
+ Copyright (C) 2025 Mark J. Wielaard <mark@klomp.org>
24+
This file is part of elfutils.
25+
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
26+
27+
@@ -38,7 +39,7 @@
28+
Dwarf_Abbrev *
29+
internal_function
30+
__libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
31+
- size_t *lengthp, Dwarf_Abbrev *result)
32+
+ size_t *lengthp)
33+
{
34+
/* Don't fail if there is not .debug_abbrev section. */
35+
if (dbg->sectiondata[IDX_debug_abbrev] == NULL)
36+
@@ -85,12 +86,7 @@ __libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
37+
Dwarf_Abbrev *abb = NULL;
38+
if (cu == NULL
39+
|| (abb = Dwarf_Abbrev_Hash_find (&cu->abbrev_hash, code)) == NULL)
40+
- {
41+
- if (result == NULL)
42+
- abb = libdw_typed_alloc (dbg, Dwarf_Abbrev);
43+
- else
44+
- abb = result;
45+
- }
46+
+ abb = libdw_typed_alloc (dbg, Dwarf_Abbrev);
47+
else
48+
{
49+
foundit = true;
50+
@@ -183,5 +179,5 @@ dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset, size_t *lengthp)
51+
return NULL;
52+
}
53+
54+
- return __libdw_getabbrev (dbg, cu, abbrev_offset + offset, lengthp, NULL);
55+
+ return __libdw_getabbrev (dbg, cu, abbrev_offset + offset, lengthp);
56+
}
57+
diff --git a/libdw/dwarf_offabbrev.c b/libdw/dwarf_offabbrev.c
58+
index 27cdad6..41df69b 100644
59+
--- a/libdw/dwarf_offabbrev.c
60+
+++ b/libdw/dwarf_offabbrev.c
61+
@@ -41,11 +41,15 @@ dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp,
62+
if (dbg == NULL)
63+
return -1;
64+
65+
- Dwarf_Abbrev *abbrev = __libdw_getabbrev (dbg, NULL, offset, lengthp,
66+
- abbrevp);
67+
+ Dwarf_Abbrev *abbrev = __libdw_getabbrev (dbg, NULL, offset, lengthp);
68+
69+
if (abbrev == NULL)
70+
return -1;
71+
72+
- return abbrev == DWARF_END_ABBREV ? 1 : 0;
73+
+ if (abbrev == DWARF_END_ABBREV)
74+
+ return 1;
75+
+
76+
+ *abbrevp = *abbrev;
77+
+
78+
+ return 0;
79+
}
80+
diff --git a/libdw/dwarf_tag.c b/libdw/dwarf_tag.c
81+
index d784970..218382a 100644
82+
--- a/libdw/dwarf_tag.c
83+
+++ b/libdw/dwarf_tag.c
84+
@@ -53,8 +53,7 @@ __libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code)
85+
86+
/* Find the next entry. It gets automatically added to the
87+
hash table. */
88+
- abb = __libdw_getabbrev (cu->dbg, cu, cu->last_abbrev_offset, &length,
89+
- NULL);
90+
+ abb = __libdw_getabbrev (cu->dbg, cu, cu->last_abbrev_offset, &length);
91+
if (abb == NULL || abb == DWARF_END_ABBREV)
92+
{
93+
/* Make sure we do not try to search for it again. */
94+
diff --git a/libdw/libdw.h b/libdw/libdw.h
95+
index 64d1689..829cc21 100644
96+
--- a/libdw/libdw.h
97+
+++ b/libdw/libdw.h
98+
@@ -587,7 +587,9 @@ extern int dwarf_srclang (Dwarf_Die *die);
99+
extern Dwarf_Abbrev *dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset,
100+
size_t *lengthp);
101+
102+
-/* Get abbreviation at given offset in .debug_abbrev section. */
103+
+/* Get abbreviation at given offset in .debug_abbrev section. On
104+
+ success return zero and fills in ABBREVP. When there is no (more)
105+
+ abbrev at offset returns one. On error returns a negative value. */
106+
extern int dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp,
107+
Dwarf_Abbrev *abbrevp)
108+
__nonnull_attribute__ (4);
109+
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
110+
index 5cbdc27..6ea34bd 100644
111+
--- a/libdw/libdwP.h
112+
+++ b/libdw/libdwP.h
113+
@@ -682,8 +682,7 @@ extern Dwarf_Abbrev *__libdw_findabbrev (struct Dwarf_CU *cu,
114+
115+
/* Get abbreviation at given offset. */
116+
extern Dwarf_Abbrev *__libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu,
117+
- Dwarf_Off offset, size_t *lengthp,
118+
- Dwarf_Abbrev *result)
119+
+ Dwarf_Off offset, size_t *lengthp)
120+
__nonnull_attribute__ (1) internal_function;
121+
122+
/* Get abbreviation of given DIE, and optionally set *READP to the DIE memory
123+
--
124+
2.45.2
125+

SPECS/elfutils/elfutils.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Summary: A collection of utilities and DSOs to handle compiled objects
55
Name: elfutils
66
Version: 0.189
7-
Release: 4%{?dist}
7+
Release: 5%{?dist}
88
License: GPLv3+ AND (GPLv2+ OR LGPLv3+)
99
Vendor: Microsoft Corporation
1010
Distribution: Azure Linux
@@ -16,6 +16,7 @@ Source1: 10-ptrace-yama.conf
1616
Patch0: CVE-2025-1372.patch
1717
Patch1: CVE-2025-1376.patch
1818
Patch2: CVE-2025-1377.patch
19+
Patch3: CVE-2025-1352.patch
1920

2021
BuildRequires: bison >= 1.875
2122
BuildRequires: bzip2-devel
@@ -282,6 +283,9 @@ fi
282283
%defattr(-,root,root)
283284

284285
%changelog
286+
* Wed Jan 15 2025 Durga Jagadeesh Palli <v-dpalli@microsoft.com> - 0.189-5
287+
- add patch for CVE-2025-1352
288+
285289
* Thu Mar 20 2025 Kanishk Bansal <kanbansal@microsoft.com> - 0.189-4
286290
- Add patch for CVE-2025-1372, CVE-2025-1376 & CVE-2025-1377
287291

toolkit/resources/manifests/package/pkggen_core_aarch64.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ popt-lang-1.19-1.azl3.aarch64.rpm
9191
sqlite-3.44.0-1.azl3.aarch64.rpm
9292
sqlite-devel-3.44.0-1.azl3.aarch64.rpm
9393
sqlite-libs-3.44.0-1.azl3.aarch64.rpm
94-
elfutils-0.189-4.azl3.aarch64.rpm
95-
elfutils-default-yama-scope-0.189-4.azl3.noarch.rpm
96-
elfutils-devel-0.189-4.azl3.aarch64.rpm
97-
elfutils-devel-static-0.189-4.azl3.aarch64.rpm
98-
elfutils-libelf-0.189-4.azl3.aarch64.rpm
99-
elfutils-libelf-devel-0.189-4.azl3.aarch64.rpm
100-
elfutils-libelf-devel-static-0.189-4.azl3.aarch64.rpm
101-
elfutils-libelf-lang-0.189-4.azl3.aarch64.rpm
94+
elfutils-0.189-5.azl3.aarch64.rpm
95+
elfutils-default-yama-scope-0.189-5.azl3.noarch.rpm
96+
elfutils-devel-0.189-5.azl3.aarch64.rpm
97+
elfutils-devel-static-0.189-5.azl3.aarch64.rpm
98+
elfutils-libelf-0.189-5.azl3.aarch64.rpm
99+
elfutils-libelf-devel-0.189-5.azl3.aarch64.rpm
100+
elfutils-libelf-devel-static-0.189-5.azl3.aarch64.rpm
101+
elfutils-libelf-lang-0.189-5.azl3.aarch64.rpm
102102
expat-2.6.4-1.azl3.aarch64.rpm
103103
expat-devel-2.6.4-1.azl3.aarch64.rpm
104104
expat-libs-2.6.4-1.azl3.aarch64.rpm

toolkit/resources/manifests/package/pkggen_core_x86_64.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ popt-lang-1.19-1.azl3.x86_64.rpm
9191
sqlite-3.44.0-1.azl3.x86_64.rpm
9292
sqlite-devel-3.44.0-1.azl3.x86_64.rpm
9393
sqlite-libs-3.44.0-1.azl3.x86_64.rpm
94-
elfutils-0.189-4.azl3.x86_64.rpm
95-
elfutils-default-yama-scope-0.189-4.azl3.noarch.rpm
96-
elfutils-devel-0.189-4.azl3.x86_64.rpm
97-
elfutils-devel-static-0.189-4.azl3.x86_64.rpm
98-
elfutils-libelf-0.189-4.azl3.x86_64.rpm
99-
elfutils-libelf-devel-0.189-4.azl3.x86_64.rpm
100-
elfutils-libelf-devel-static-0.189-4.azl3.x86_64.rpm
101-
elfutils-libelf-lang-0.189-4.azl3.x86_64.rpm
94+
elfutils-0.189-5.azl3.x86_64.rpm
95+
elfutils-default-yama-scope-0.189-5.azl3.noarch.rpm
96+
elfutils-devel-0.189-5.azl3.x86_64.rpm
97+
elfutils-devel-static-0.189-5.azl3.x86_64.rpm
98+
elfutils-libelf-0.189-5.azl3.x86_64.rpm
99+
elfutils-libelf-devel-0.189-5.azl3.x86_64.rpm
100+
elfutils-libelf-devel-static-0.189-5.azl3.x86_64.rpm
101+
elfutils-libelf-lang-0.189-5.azl3.x86_64.rpm
102102
expat-2.6.4-1.azl3.x86_64.rpm
103103
expat-devel-2.6.4-1.azl3.x86_64.rpm
104104
expat-libs-2.6.4-1.azl3.x86_64.rpm

toolkit/resources/manifests/package/toolchain_aarch64.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ e2fsprogs-debuginfo-1.47.0-2.azl3.aarch64.rpm
8585
e2fsprogs-devel-1.47.0-2.azl3.aarch64.rpm
8686
e2fsprogs-lang-1.47.0-2.azl3.aarch64.rpm
8787
e2fsprogs-libs-1.47.0-2.azl3.aarch64.rpm
88-
elfutils-0.189-4.azl3.aarch64.rpm
89-
elfutils-debuginfo-0.189-4.azl3.aarch64.rpm
90-
elfutils-default-yama-scope-0.189-4.azl3.noarch.rpm
91-
elfutils-devel-0.189-4.azl3.aarch64.rpm
92-
elfutils-devel-static-0.189-4.azl3.aarch64.rpm
93-
elfutils-libelf-0.189-4.azl3.aarch64.rpm
94-
elfutils-libelf-devel-0.189-4.azl3.aarch64.rpm
95-
elfutils-libelf-devel-static-0.189-4.azl3.aarch64.rpm
96-
elfutils-libelf-lang-0.189-4.azl3.aarch64.rpm
88+
elfutils-0.189-5.azl3.aarch64.rpm
89+
elfutils-debuginfo-0.189-5.azl3.aarch64.rpm
90+
elfutils-default-yama-scope-0.189-5.azl3.noarch.rpm
91+
elfutils-devel-0.189-5.azl3.aarch64.rpm
92+
elfutils-devel-static-0.189-5.azl3.aarch64.rpm
93+
elfutils-libelf-0.189-5.azl3.aarch64.rpm
94+
elfutils-libelf-devel-0.189-5.azl3.aarch64.rpm
95+
elfutils-libelf-devel-static-0.189-5.azl3.aarch64.rpm
96+
elfutils-libelf-lang-0.189-5.azl3.aarch64.rpm
9797
expat-2.6.4-1.azl3.aarch64.rpm
9898
expat-debuginfo-2.6.4-1.azl3.aarch64.rpm
9999
expat-devel-2.6.4-1.azl3.aarch64.rpm

toolkit/resources/manifests/package/toolchain_x86_64.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ e2fsprogs-debuginfo-1.47.0-2.azl3.x86_64.rpm
9090
e2fsprogs-devel-1.47.0-2.azl3.x86_64.rpm
9191
e2fsprogs-lang-1.47.0-2.azl3.x86_64.rpm
9292
e2fsprogs-libs-1.47.0-2.azl3.x86_64.rpm
93-
elfutils-0.189-4.azl3.x86_64.rpm
94-
elfutils-debuginfo-0.189-4.azl3.x86_64.rpm
95-
elfutils-default-yama-scope-0.189-4.azl3.noarch.rpm
96-
elfutils-devel-0.189-4.azl3.x86_64.rpm
97-
elfutils-devel-static-0.189-4.azl3.x86_64.rpm
98-
elfutils-libelf-0.189-4.azl3.x86_64.rpm
99-
elfutils-libelf-devel-0.189-4.azl3.x86_64.rpm
100-
elfutils-libelf-devel-static-0.189-4.azl3.x86_64.rpm
101-
elfutils-libelf-lang-0.189-4.azl3.x86_64.rpm
93+
elfutils-0.189-5.azl3.x86_64.rpm
94+
elfutils-debuginfo-0.189-5.azl3.x86_64.rpm
95+
elfutils-default-yama-scope-0.189-5.azl3.noarch.rpm
96+
elfutils-devel-0.189-5.azl3.x86_64.rpm
97+
elfutils-devel-static-0.189-5.azl3.x86_64.rpm
98+
elfutils-libelf-0.189-5.azl3.x86_64.rpm
99+
elfutils-libelf-devel-0.189-5.azl3.x86_64.rpm
100+
elfutils-libelf-devel-static-0.189-5.azl3.x86_64.rpm
101+
elfutils-libelf-lang-0.189-5.azl3.x86_64.rpm
102102
expat-2.6.4-1.azl3.x86_64.rpm
103103
expat-debuginfo-2.6.4-1.azl3.x86_64.rpm
104104
expat-devel-2.6.4-1.azl3.x86_64.rpm

0 commit comments

Comments
 (0)