Compare commits

...

2 Commits
a10 ... c8

Author SHA1 Message Date
27ea3d4cb0 import UBI binutils-2.30-128.el8_10 2025-12-18 13:31:14 +00:00
6d57ac4c18 import UBI binutils-2.30-127.el8_10 2025-10-07 06:23:19 +00:00
4 changed files with 2277 additions and 112 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
From 9ca499644a21ceb3f946d1c179c38a83be084490 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
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 <hjl.tools@gmail.com>
---
bfd/elfcode.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
--- binutils-2.30.orig/bfd/elfcode.h 2025-11-12 10:36:58.003807494 +0000
+++ binutils-2.30/bfd/elfcode.h 2025-11-12 10:38:58.300780133 +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 bfd_boolean
elf_swap_shdr_in (bfd *abfd,
const Elf_External_Shdr *src,
Elf_Internal_Shdr *dst)
@@ -314,12 +314,31 @@ elf_swap_shdr_in (bfd *abfd,
dst->sh_addr = H_GET_WORD (abfd, src->sh_addr);
dst->sh_offset = H_GET_WORD (abfd, src->sh_offset);
dst->sh_size = H_GET_WORD (abfd, src->sh_size);
+
+ /* PR 23657. Check for invalid section size, in sections with contents.
+ Note - we do not set an error value here because the contents
+ of this particular section might not be needed by the consumer. */
+ if (dst->sh_type != SHT_NOBITS)
+ {
+ ufile_ptr filesize = bfd_get_file_size (abfd);
+
+ if (filesize != 0 && dst->sh_size > filesize)
+ {
+ _bfd_error_handler
+ (_("warning: %pB has a corrupt section with a size (%"
+ BFD_VMA_FMT "x) larger than the file size"),
+ abfd, dst->sh_size);
+ return FALSE;
+ }
+ }
+
dst->sh_link = H_GET_32 (abfd, src->sh_link);
dst->sh_info = H_GET_32 (abfd, src->sh_info);
dst->sh_addralign = H_GET_WORD (abfd, src->sh_addralign);
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
@@ -613,9 +632,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. */
@@ -699,9 +718,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)

View File

@ -0,0 +1,135 @@
diff -rup binutils.orig/bfd/elfxx-mips.c binutils-2.30/bfd/elfxx-mips.c
--- binutils.orig/bfd/elfxx-mips.c 2025-04-14 14:37:39.493183565 +0100
+++ binutils-2.30/bfd/elfxx-mips.c 2025-04-14 15:21:46.790126109 +0100
@@ -12663,7 +12663,13 @@ _bfd_mips_elf_find_nearest_line (bfd *ab
if (_bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset,
filename_ptr, functionname_ptr,
line_ptr))
- return TRUE;
+ {
+ if (!*functionname_ptr)
+ _bfd_elf_find_function (abfd, symbols, section, offset,
+ *filename_ptr ? NULL : filename_ptr,
+ functionname_ptr);
+ return TRUE;
+ }
msec = bfd_get_section_by_name (abfd, ".mdebug");
if (msec != NULL)
Only in binutils-2.30/bfd: elfxx-mips.c.orig
Only in binutils-2.30/bfd: elfxx-mips.c.rej
--- binutils.orig/bfd/elfnn-aarch64.c 2025-04-14 16:12:13.360826181 +0100
+++ binutils-2.30/bfd/elfnn-aarch64.c 2025-04-14 16:12:23.093850802 +0100
@@ -9340,9 +9340,6 @@ const struct elf_size_info elfNN_aarch64
#define bfd_elfNN_find_inliner_info \
elfNN_aarch64_find_inliner_info
-#define bfd_elfNN_find_nearest_line \
- elfNN_aarch64_find_nearest_line
-
#define bfd_elfNN_mkobject \
elfNN_aarch64_mkobject
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2025-04-14 16:53:49.130385164 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/shared.exp 2025-04-14 16:55:00.988577546 +0100
@@ -1175,5 +1175,5 @@ proc mix_pic_and_non_pic {xfails cflags
}
}
-mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719"
+mix_pic_and_non_pic [list "arm*-*-*"] "" "" "pr19719"
mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"
--- binutils.orig/binutils/testsuite/binutils-all/note-4-32.d 2025-04-14 17:23:54.644395476 +0100
+++ binutils-2.30/binutils/testsuite/binutils-all/note-4-32.d 2025-04-14 17:26:39.586454845 +0100
@@ -7,7 +7,7 @@
#...
Displaying notes found in: .gnu.build.attributes
[ ]+Owner[ ]+Data size[ ]+Description
-[ ]+GA\$<version>3p3[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 \(note_4.s\)
+[ ]+GA\$<version>3p3[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x10. to 0x11.*
[ ]+GA\*<stack prot>off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110
[ ]+GA\$<tool>gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110
[ ]+GA\*<ABI>0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2025-04-14 17:23:54.830382824 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp 2025-04-14 17:31:18.698165689 +0100
@@ -33,8 +33,6 @@ if { [which $CC] == 0 } {
# Square bracket expressions seem to confuse istarget.
if { ![istarget hppa*64*-*-hpux*] \
&& ![istarget hppa*-*-linux*] \
- && ![istarget i?86-*-linux*] \
- && ![istarget i?86-*-gnu*] \
&& ![istarget *-*-nacl*] \
&& ![istarget ia64-*-linux*] \
&& ![istarget m68k-*-linux*] \
--- binutils.orig/ld/testsuite/ld-gc/pr14265.d 2025-04-14 17:23:54.911798140 +0100
+++ binutils-2.30/ld/testsuite/ld-gc/pr14265.d 2025-04-14 17:36:40.474995921 +0100
@@ -2,6 +2,7 @@
#source: dummy.s
#ld: --gc-sections -T pr14265.t -e 0 tmpdir/pr14265.o
#nm: --format=bsd --numeric-sort
+#xfail: i686-*
#...
[0-9a-f]+[ ][dD][ ]_*foo1_start
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2025-04-14 17:23:54.814035200 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2025-04-14 17:39:31.828450692 +0100
@@ -539,6 +539,7 @@ global PLT_CFLAGS
if { [isnative]
&& [istarget "i?86-*-linux*"]
&& [which $CC] != 0 } {
+ return
run_cc_link_tests [list \
[list \
"Build plt-lib.so" \
--- binutils.orig/ld/testsuite/ld-scripts/crossref.exp 2025-04-14 17:23:54.961035575 +0100
+++ binutils-2.30/ld/testsuite/ld-scripts/crossref.exp 2025-04-14 17:41:29.996764330 +0100
@@ -193,6 +193,8 @@ set exec_output [prune_warnings $exec_ou
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
+setup_xfail i686-*-*
+
if [string match "" $exec_output] then {
pass $test6
} else {
@@ -205,6 +207,8 @@ set exec_output [prune_warnings $exec_ou
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
+setup_xfail i686-*-*
+
if [string match "" $exec_output] then {
fail $test7
} else {
--- binutils.orig/ld/testsuite/ld-shared/shared.exp 2025-04-14 17:23:54.876443086 +0100
+++ binutils-2.30/ld/testsuite/ld-shared/shared.exp 2025-04-14 17:42:32.339929783 +0100
@@ -37,8 +37,6 @@ if { ![istarget hppa*64*-*-hpux*] \
&& ![istarget i?86-*-sysv4*] \
&& ![istarget i?86-*-unixware] \
&& ![istarget i?86-*-elf*] \
- && ![istarget i?86-*-linux*] \
- && ![istarget i?86-*-gnu*] \
&& ![istarget *-*-nacl*] \
&& ![istarget ia64-*-elf*] \
&& ![istarget ia64-*-linux*] \
--- binutils.orig/ld/testsuite/ld-srec/srec.exp 2025-04-14 17:23:54.819825564 +0100
+++ binutils-2.30/ld/testsuite/ld-srec/srec.exp 2025-04-14 17:43:53.365144820 +0100
@@ -19,7 +19,7 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-if [istarget x86_64-*-*] {
+if { [istarget x86_64-*-*] || [istarget i686-*-*] } {
# The S-record tests are failing for some configurations
# of x86_64-linux builds, but not others. Not worth
# investigating however as S-record conversion can always
--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2025-04-14 18:29:06.287599336 +0100
+++ binutils-2.30/ld/testsuite/ld-elfvsb/elfvsb.exp 2025-04-14 18:31:19.684761021 +0100
@@ -41,7 +41,6 @@ if { ![istarget hppa*64*-*-hpux*] \
&& ![istarget arm*-*-linux*] \
&& ![istarget alpha*-*-linux*] \
&& ![istarget sparc*-*-linux*] \
- && ![istarget s390*-*-linux*] \
&& ![istarget sh\[34\]*-*-linux*] \
&& ![istarget x86_64-*-linux*] } {
return

View File

@ -43,7 +43,7 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.30
Release: 125%{?dist}
Release: 128%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -667,6 +667,19 @@ Patch110: binutils-CVE-2018-12699-part6-PR28862.patch
# Lifetime: 2.35
Patch111: binutils-CVE-2018-12699-part7-PR28718.patch
# Purpose: Add support to the BFD library for separate debuginfo files created by dwz.
# Lifetime: 2.35
Patch112: binutils-Add-BFD-support-for-dwz-files.patch
# Purpose: Fix/workaround more linker testsuite failures.
# Lifetime: 2.35
Patch113: binutils-more-testsuite-failures.patch
# Purpose: Stops a potential illegal memory access when linking a corrupt
# input file. PR 33457
# Lifetime: Fixed in 2.46
Patch114: binutils-CVE-2025-11083.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
@ -804,117 +817,7 @@ using libelf instead of BFD.
%prep
%setup -q -n binutils-%{version}
%patch01 -p1
%patch02 -p1
%patch03 -p1
%patch04 -p1
%patch05 -p1
%patch06 -p1
%patch07 -p1
%patch08 -p1
%patch09 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
%patch84 -p1
%patch85 -p1
%patch86 -p1
%patch87 -p1
%patch88 -p1
%patch89 -p1
%patch90 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%autosetup -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
# FIXME - this is no longer true. Maybe try reinstating autotool use ?
@ -1115,6 +1018,13 @@ if [-f gold/testsuite/test-suite.log ]; then
rm -f binutils-%{_target_platform}-gold.log.tar.xz
fi
%endif
# Run the tests and this time fail if there are any errors.
echo ====================RE-TESTING=========================
make -k check-gas check-binutils check-ld < /dev/null
# Ignore the gold tests - they always fail
echo ====================RE-TESTING END=====================
%endif
#----------------------------------------------------------------------------
@ -1364,6 +1274,16 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Wed Nov 12 2025 Nick Clifton <nickc@redhat.com> - 2.30-128
- Fix a potential illegal memory access when linking a corrupt input file. (RHEL-126878)
* Mon Apr 14 2025 Nick Clifton <nickc@redhat.com> - 2.30-127
- Spec file: Rerun testsuites in order to fail build if the tests fail.
- Import fix for PR 23652 in order to avoid AArch64 mapping symbols in linker error messages. (RHEL-84080)
* Wed Nov 06 2024 Nick Clifton <nickc@redhat.com> - 2.30-126
- Fix problems reading dwz created debug info files. (RHEL-84080)
* Wed Nov 06 2024 Nick Clifton <nickc@redhat.com> - 2.30-125
- Fix illegal memory accesses when parsing corrupt a.out format files. (RHEL-64927)