From c77184d4032b659f362164a4facf862a69f3f743 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 6 Mar 2019 09:50:21 +0000 Subject: [PATCH] Stop potential illegal memory access when disassembling an EFI binary. Resolves: #1685727 --- binutils-disassembling-efi-files.patch | 39 ++++++++++++++++++++++++++ binutils.spec | 10 ++++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 binutils-disassembling-efi-files.patch diff --git a/binutils-disassembling-efi-files.patch b/binutils-disassembling-efi-files.patch new file mode 100644 index 0000000..75d4275 --- /dev/null +++ b/binutils-disassembling-efi-files.patch @@ -0,0 +1,39 @@ +diff -rup binutils.orig/bfd/coffgen.c binutils-2.31.1/bfd/coffgen.c +--- binutils.orig/bfd/coffgen.c 2019-03-06 08:49:19.500586870 +0000 ++++ binutils-2.31.1/bfd/coffgen.c 2019-03-06 08:49:45.798394582 +0000 +@@ -2289,7 +2289,7 @@ coff_find_nearest_line_with_names (bfd * + information. So try again, using a bias against the address sought. */ + if (coff_data (abfd)->dwarf2_find_line_info != NULL) + { +- bfd_signed_vma bias; ++ bfd_signed_vma bias = 0; + + /* Create a cache of the result for the next call. */ + if (sec_data == NULL && section->owner == abfd) +@@ -2301,10 +2301,11 @@ coff_find_nearest_line_with_names (bfd * + + if (sec_data != NULL && sec_data->saved_bias) + bias = sec_data->saved_bias; +- else ++ else if (symbols) + { + bias = _bfd_dwarf2_find_symbol_bias (symbols, + & coff_data (abfd)->dwarf2_find_line_info); ++ + if (sec_data) + { + sec_data->saved_bias = TRUE; +Only in binutils-2.31.1/bfd: coffgen.c.orig +diff -rup binutils.orig/bfd/dwarf2.c binutils-2.31.1/bfd/dwarf2.c +--- binutils.orig/bfd/dwarf2.c 2019-03-06 08:49:19.498586884 +0000 ++++ binutils-2.31.1/bfd/dwarf2.c 2019-03-06 08:49:45.799394575 +0000 +@@ -4463,7 +4463,7 @@ _bfd_dwarf2_find_symbol_bias (asymbol ** + + stash = (struct dwarf2_debug *) *pinfo; + +- if (stash == NULL) ++ if (stash == NULL || symbols == NULL) + return 0; + + for (unit = stash->all_comp_units; unit; unit = unit->next_unit) +Only in binutils-2.31.1/bfd: dwarf2.c.orig diff --git a/binutils.spec b/binutils.spec index eec69e3..94076d2 100644 --- a/binutils.spec +++ b/binutils.spec @@ -80,7 +80,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.32 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -193,6 +193,10 @@ Patch16: binutils-CVE-2019-9075.patch # Lifetime: Fixed in 2.33 Patch17: binutils-CVE-2019-9077.patch +# Purpose: Stop a seg-fault when disassembling an EFI binary. +# Lifetime: Fixed in 2.33 +Patch18: binutils-disassembling-efi-files.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -335,6 +339,7 @@ Conflicts: gcc-c++ < 4.0.0 %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -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 ? @@ -739,6 +744,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Wed Mar 06 2019 Nick Clifton - 2.32-9 +- Stop potential illegal memory access when disassembling an EFI binary. (#1685727) + * Wed Feb 27 2019 Nick Clifton - 2.32-8 - Fix requirements and use of the alternatives mechanism. (#1683408, #1683466)