From: Deepesh Varatharajan Date: Mon, 28 Apr 2025 09:41:11 +0000 (-0700) Subject: binutils: Fix CVE-2025-1178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e820e5364c4b3ec52796a77842b480fea8bc7967;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git binutils: Fix CVE-2025-1178 Prevent an abort in the bfd linker when attempting to generate dynamic relocs for a corrupt input file. PR 32638 Backport a patch from upstream to fix CVE-2025-1178 Upstream-Status: Backport from [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=75086e9de1707281172cc77f178e7949a4414ed0] Signed-off-by: Deepesh Varatharajan Signed-off-by: Steve Sakoman --- diff --git a/meta/recipes-devtools/binutils/binutils-2.38.inc b/meta/recipes-devtools/binutils/binutils-2.38.inc index 26d0b570f3..82dd5c9eb6 100644 --- a/meta/recipes-devtools/binutils/binutils-2.38.inc +++ b/meta/recipes-devtools/binutils/binutils-2.38.inc @@ -73,5 +73,6 @@ SRC_URI = "\ file://0036-CVE-2023-39130.patch \ file://0037-CVE-2024-53589.patch \ file://0038-CVE-2025-0840.patch \ + file://0039-CVE-2025-1178.patch \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/0039-CVE-2025-1178.patch b/meta/recipes-devtools/binutils/binutils/0039-CVE-2025-1178.patch new file mode 100644 index 0000000000..9d2054abab --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0039-CVE-2025-1178.patch @@ -0,0 +1,33 @@ +From 75086e9de1707281172cc77f178e7949a4414ed0 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 5 Feb 2025 13:26:51 +0000 +Subject: [PATCH] Prevent an abort in the bfd linker when attempting to + generate dynamic relocs for a corrupt input file. + +PR 32638 + +Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=75086e9de1707281172cc77f178e7949a4414ed0] +CVE: CVE-2025-1178 + +Signed-off-by: Deepesh Varatharajan + +diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c +index 970379de..cbd16abc 100644 +--- a/bfd/elf64-x86-64.c ++++ b/bfd/elf64-x86-64.c +@@ -4575,6 +4575,15 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, + + if (generate_dynamic_reloc) + { ++ /* If the relgot section has not been created, then ++ generate an error instead of a reloc. cf PR 32638. */ ++ if (relgot == NULL || relgot->size == 0) ++ { ++ info->callbacks->einfo (_("%F%pB: Unable to generate dynamic relocs because a suitable section does not exist\n"), ++ output_bfd); ++ return false; ++ } ++ + if (relative_reloc_name != NULL + && htab->params->report_relative_reloc) + _bfd_x86_elf_link_report_relative_reloc