From e9e58b03c8a72448eed062a74310ffae550ea145 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 18 Dec 2025 11:54:44 +0000 Subject: [PATCH] import UBI gcc-toolset-13-binutils-2.40-21.el9_7.1 --- SOURCES/binutils-CVE-2025-11083.patch | 71 +++++++++++++++++++++++++++ SPECS/binutils.spec | 10 +++- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 SOURCES/binutils-CVE-2025-11083.patch diff --git a/SOURCES/binutils-CVE-2025-11083.patch b/SOURCES/binutils-CVE-2025-11083.patch new file mode 100644 index 0000000..6f2de42 --- /dev/null +++ b/SOURCES/binutils-CVE-2025-11083.patch @@ -0,0 +1,71 @@ +From 9ca499644a21ceb3f946d1c179c38a83be084490 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" +Date: Thu, 18 Sep 2025 16:59:25 -0700 +Subject: [PATCH] elf: Don't match corrupt section header in linker input + +Don't swap in nor match corrupt section header in linker input to avoid +linker crash later. + + PR ld/33457 + * elfcode.h (elf_swap_shdr_in): Changed to return bool. Return + false for corrupt section header in linker input. + (elf_object_p): Reject if elf_swap_shdr_in returns false. + +Signed-off-by: H.J. Lu +--- + bfd/elfcode.h | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +--- binutils-2.40.orig/bfd/elfcode.h 2025-11-27 14:21:37.669884082 +0000 ++++ binutils-2.40/bfd/elfcode.h 2025-11-27 14:22:11.297013798 +0000 +@@ -298,7 +298,7 @@ elf_swap_ehdr_out (bfd *abfd, + /* Translate an ELF section header table entry in external format into an + ELF section header table entry in internal format. */ + +-static void ++static bool + elf_swap_shdr_in (bfd *abfd, + const Elf_External_Shdr *src, + Elf_Internal_Shdr *dst) +@@ -328,6 +328,9 @@ elf_swap_shdr_in (bfd *abfd, + { + _bfd_error_handler (_("warning: %pB has a section " + "extending past end of file"), abfd); ++ /* PR ld/33457: Don't match corrupt section header. */ ++ if (abfd->is_linker_input) ++ return false; + abfd->read_only = 1; + } + } +@@ -337,6 +340,7 @@ elf_swap_shdr_in (bfd *abfd, + dst->sh_entsize = H_GET_WORD (abfd, src->sh_entsize); + dst->bfd_section = NULL; + dst->contents = NULL; ++ return true; + } + + /* Translate an ELF section header table entry in internal format into an +@@ -629,9 +633,9 @@ elf_object_p (bfd *abfd) + + /* Read the first section header at index 0, and convert to internal + form. */ +- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) ++ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr) ++ || !elf_swap_shdr_in (abfd, &x_shdr, &i_shdr)) + goto got_no_match; +- elf_swap_shdr_in (abfd, &x_shdr, &i_shdr); + + /* If the section count is zero, the actual count is in the first + section header. */ +@@ -717,9 +721,9 @@ elf_object_p (bfd *abfd) + to internal form. */ + for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++) + { +- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) ++ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr) ++ || !elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex)) + goto got_no_match; +- elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex); + + /* Sanity check sh_link and sh_info. */ + if (i_shdrp[shindex].sh_link >= num_sec) diff --git a/SPECS/binutils.spec b/SPECS/binutils.spec index bd815b1..dd256a3 100644 --- a/SPECS/binutils.spec +++ b/SPECS/binutils.spec @@ -9,7 +9,7 @@ BuildRequires: scl-utils-build Summary: A GNU collection of binary utilities Name: %{?scl_prefix}binutils Version: 2.40 -Release: 21%{?dist} +Release: 21%{?dist}.1 License: GPLv3+ URL: https://sourceware.org/binutils @@ -281,6 +281,11 @@ Patch21: binutils-CVE-2023-1972.patch # Lifetime: Fixed in 2.42 Patch22: binutils-AMD-znver5.patch +# Purpose: Stops a potential illegal memory access when linking a corrupt +# input file. PR 33457 +# Lifetime: Fixed in 2.46 +Patch23: binutils-CVE-2025-11083.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -1313,6 +1318,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Thu Nov 27 2025 Nick Clifton - 2.40-21.1 +- Fix a potential illegal memory access when linking a corrupt input file. (RHEL-130652) + * Thu Feb 22 2024 Nick Clifton - 2.40-21 - Run x86_64 assembler tests for znver5 architecture extension. (RHEL-23798)