summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/elfutils/elfutils_0.192.bb1
-rw-r--r--meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch57
2 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.192.bb b/meta/recipes-devtools/elfutils/elfutils_0.192.bb
index 4dcc774bb9..f8cf083ec6 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.192.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.192.bb
@@ -26,6 +26,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
26 file://CVE-2025-1365.patch \ 26 file://CVE-2025-1365.patch \
27 file://CVE-2025-1371.patch \ 27 file://CVE-2025-1371.patch \
28 file://CVE-2025-1372.patch \ 28 file://CVE-2025-1372.patch \
29 file://CVE-2025-1376.patch \
29 " 30 "
30SRC_URI:append:libc-musl = " \ 31SRC_URI:append:libc-musl = " \
31 file://0003-musl-utils.patch \ 32 file://0003-musl-utils.patch \
diff --git a/meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch b/meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch
new file mode 100644
index 0000000000..ebffb2bd72
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch
@@ -0,0 +1,57 @@
1From b16f441cca0a4841050e3215a9f120a6d8aea918 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Thu, 13 Feb 2025 00:02:32 +0100
4Subject: [PATCH] libelf: Handle elf_strptr on section without any data
5
6In the unlikely situation that elf_strptr was called on a section with
7sh_size already set, but that doesn't have any data yet we could crash
8trying to verify the string to return.
9
10This could happen for example when a new section was created with
11elf_newscn, but no data having been added yet.
12
13 * libelf/elf_strptr.c (elf_strptr): Check strscn->rawdata_base
14 is not NULL.
15
16https://sourceware.org/bugzilla/show_bug.cgi?id=32672
17
18CVE: CVE-2025-1376
19
20Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=b16f441cca0a4841050e3215a9f120a6d8aea918]
21
22Signed-off-by: Mark Wielaard <mark@klomp.org>
23Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
24---
25 libelf/elf_strptr.c | 10 +++++++---
26 1 file changed, 7 insertions(+), 3 deletions(-)
27
28diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c
29index c5a94f8..7be7f5e 100644
30--- a/libelf/elf_strptr.c
31+++ b/libelf/elf_strptr.c
32@@ -1,5 +1,6 @@
33 /* Return string pointer from string section.
34 Copyright (C) 1998-2002, 2004, 2008, 2009, 2015 Red Hat, Inc.
35+ Copyright (C) 2025 Mark J. Wielaard <mark@klomp.org>
36 This file is part of elfutils.
37 Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
38
39@@ -183,9 +184,12 @@ elf_strptr (Elf *elf, size_t idx, size_t offset)
40 // initialized yet (when data_read is zero). So we cannot just
41 // look at the rawdata.d.d_size.
42
43- /* Make sure the string is NUL terminated. Start from the end,
44- which very likely is a NUL char. */
45- if (likely (validate_str (strscn->rawdata_base, offset, sh_size)))
46+ /* First check there actually is any data. This could be a new
47+ section which hasn't had any data set yet. Then make sure
48+ the string is at a valid offset and NUL terminated. */
49+ if (unlikely (strscn->rawdata_base == NULL))
50+ __libelf_seterrno (ELF_E_INVALID_SECTION);
51+ else if (likely (validate_str (strscn->rawdata_base, offset, sh_size)))
52 result = &strscn->rawdata_base[offset];
53 else
54 __libelf_seterrno (ELF_E_INVALID_INDEX);
55--
562.43.2
57