diff options
| -rw-r--r-- | meta/recipes-devtools/elfutils/elfutils_0.192.bb | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/elfutils/files/CVE-2025-1376.patch | 57 |
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 | " |
| 30 | SRC_URI:append:libc-musl = " \ | 31 | SRC_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 @@ | |||
| 1 | From b16f441cca0a4841050e3215a9f120a6d8aea918 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mark Wielaard <mark@klomp.org> | ||
| 3 | Date: Thu, 13 Feb 2025 00:02:32 +0100 | ||
| 4 | Subject: [PATCH] libelf: Handle elf_strptr on section without any data | ||
| 5 | |||
| 6 | In the unlikely situation that elf_strptr was called on a section with | ||
| 7 | sh_size already set, but that doesn't have any data yet we could crash | ||
| 8 | trying to verify the string to return. | ||
| 9 | |||
| 10 | This could happen for example when a new section was created with | ||
| 11 | elf_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 | |||
| 16 | https://sourceware.org/bugzilla/show_bug.cgi?id=32672 | ||
| 17 | |||
| 18 | CVE: CVE-2025-1376 | ||
| 19 | |||
| 20 | Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=b16f441cca0a4841050e3215a9f120a6d8aea918] | ||
| 21 | |||
| 22 | Signed-off-by: Mark Wielaard <mark@klomp.org> | ||
| 23 | Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> | ||
| 24 | --- | ||
| 25 | libelf/elf_strptr.c | 10 +++++++--- | ||
| 26 | 1 file changed, 7 insertions(+), 3 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c | ||
| 29 | index 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 | -- | ||
| 56 | 2.43.2 | ||
| 57 | |||
