diff --git a/backport-PR28186-SEGV-elf.c-7991-30-in-_bfd_elf_fixup_group_sections.patch b/backport-PR28186-SEGV-elf.c-7991-30-in-_bfd_elf_fixup_group_sections.patch new file mode 100644 index 0000000000000000000000000000000000000000..5adcb20e73c93eeda8b2294a53d159d9791f0aa2 --- /dev/null +++ b/backport-PR28186-SEGV-elf.c-7991-30-in-_bfd_elf_fixup_group_sections.patch @@ -0,0 +1,32 @@ +From d86cf1b0d5ac6c0d900ae2b2a07fce7c4414d0e6 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Sat, 7 Aug 2021 14:10:38 +0930 +Subject: [PATCH] PR28186, SEGV elf.c:7991:30 in _bfd_elf_fixup_group_sections + + PR 28186 + * elf.c (_bfd_elf_fixup_group_sections): Don't segfault on + objcopy/strip with NULL output_section. + +(cherry picked from commit 182ad37589e3931390d0c43f1d52a9a6e0062a61) +Reference:https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d86cf1b0d5ac6c0d900ae2b2a07fce7c4414d0e6 +Conflict:NA +--- + bfd/elf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bfd/elf.c b/bfd/elf.c +index de5abafabf0..9c3f34c415b 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -7984,7 +7984,7 @@ _bfd_elf_fixup_group_sections (bfd *ibfd, asection *discarded) + isec->flags |= SEC_EXCLUDE; + } + } +- else ++ else if (isec->output_section != NULL) + { + /* Adjust the output section size when called from + objcopy. */ +-- +2.23.0 + diff --git a/backport-PR28422-build_id-use-after-free.patch b/backport-PR28422-build_id-use-after-free.patch new file mode 100644 index 0000000000000000000000000000000000000000..884fe8c45a8873af89e3d7e3860afae7bca9c452 --- /dev/null +++ b/backport-PR28422-build_id-use-after-free.patch @@ -0,0 +1,33 @@ +From c20c7adbeaa3af18a58ba1e20e6c33e7186356e3 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Wed, 6 Oct 2021 18:28:47 +1030 +Subject: [PATCH] PR28422, build_id use-after-free + +This fixes a bug in commit 5d9bbb73c1df. All fields preserved from a +bfd in struct bfd_preserve need to be cleared in bfd_reinit. + + PR 28422 + * format.c (bfd_reinit): Clear build_id. + +(cherry picked from commit 6d661cdc5be46e890ed9255e749806f46a88e26c) +Reference:https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c20c7adbeaa3af18a58ba1e20e6c33e7186356e3 +Conflict:NA +--- + bfd/format.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/bfd/format.c b/bfd/format.c +index 5d08d1d642c..408c984690e 100644 +--- a/bfd/format.c ++++ b/bfd/format.c +@@ -151,6 +151,7 @@ bfd_reinit (bfd *abfd, unsigned int section_id, bfd_cleanup cleanup) + abfd->tdata.any = NULL; + abfd->arch_info = &bfd_default_arch_struct; + abfd->flags &= BFD_FLAGS_SAVED; ++ abfd->build_id = NULL; + bfd_section_list_clear (abfd); + } + +-- +2.23.0 + diff --git a/backport-PR28540-segmentation-fault-on-NULL-byte_get.patch b/backport-PR28540-segmentation-fault-on-NULL-byte_get.patch new file mode 100644 index 0000000000000000000000000000000000000000..a6dfba692016a3d4fb1b9c13715dc22eb230954f --- /dev/null +++ b/backport-PR28540-segmentation-fault-on-NULL-byte_get.patch @@ -0,0 +1,32 @@ +From 96eb21265ebffbc28f767bed9a2b7650ecb9818d Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Thu, 4 Nov 2021 14:11:02 +1030 +Subject: [PATCH] PR28540, segmentation fault on NULL byte_get + + PR 28540 + * objdump.c (dump_bfd): Don't attempt load_separate_debug_files + when byte_get is NULL. + +(cherry picked from commit f2f105f518413ea3e4c212f89585f9a8a5dddcdd) +Reference:https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=96eb21265ebffbc28f767bed9a2b7650ecb9818d +Conflict:NA +--- + binutils/objdump.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/binutils/objdump.c b/binutils/objdump.c +index a7b8303b992..50317b3d48f 100644 +--- a/binutils/objdump.c ++++ b/binutils/objdump.c +@@ -4869,7 +4869,7 @@ dump_bfd (bfd *abfd, bool is_mainfile) + + The test on is_mainfile is there because the chain of separate debug + info files is a global variable shared by all invocations of dump_bfd. */ +- if (is_mainfile) ++ if (byte_get != NULL && is_mainfile) + { + load_separate_debug_files (abfd, bfd_get_filename (abfd)); + +-- +2.23.0 + diff --git a/binutils.spec b/binutils.spec index 60668771df41762ad6180f5be1bb36919300bdee..d70dc74a19313fedde77ea7b56321afb12fdb018 100644 --- a/binutils.spec +++ b/binutils.spec @@ -1,7 +1,7 @@ Summary: Binary utilities Name: binutils Version: 2.37 -Release: 10 +Release: 11 License: GPLv3+ URL: https://sourceware.org/binutils @@ -36,6 +36,9 @@ Patch13: backport-0001-texi2pod.pl-add-no-op-no-split-option-support-PR2814.patc Patch14: backport-AArch64-Add-support-for-AArch64-EFI-efi-aarch64.patch Patch15: backport-Add-support-for-AArch64-EFI-efi-aarch64.patch Patch16: backport-don-t-over-align-file-positions-of-PE-executable-sec.patch +Patch17: backport-PR28186-SEGV-elf.c-7991-30-in-_bfd_elf_fixup_group_sections.patch +Patch18: backport-PR28422-build_id-use-after-free.patch +Patch19: backport-PR28540-segmentation-fault-on-NULL-byte_get.patch Provides: bundled(libiberty) @@ -359,6 +362,9 @@ fi %{_infodir}/bfd*info* %changelog +* Sat Oct 29 2022 huyubiao - 2.37-11 +- DESC:Prevents the use of null pointers and sets the pointer to null after being used. + * Sat Oct 08 2022 Chenxi Mao - 2.37-10 - Fix Aarch64 EFI PE section address overlap issue.