From 8328d019022645fe0c4008c793039850036e710d Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Jan 30 2019 11:53:06 +0000 Subject: Fix the assembler's check that the output file is not also one of the input files. Resolves: #1660279 --- diff --git a/binutils-gas-input-matches-output.patch b/binutils-gas-input-matches-output.patch new file mode 100644 index 0000000..76eab57 --- /dev/null +++ b/binutils-gas-input-matches-output.patch @@ -0,0 +1,37 @@ +--- binutils.orig/gas/as.c 2019-01-30 11:02:04.055574300 +0000 ++++ binutils-2.31.1/gas/as.c 2019-01-30 11:03:12.212050935 +0000 +@@ -1254,14 +1254,27 @@ main (int argc, char ** argv) + { + struct stat sib; + +- if (stat (argv[i], &sib) == 0) ++ /* Check that the input file and output file are different. */ ++ if (stat (argv[i], &sib) == 0 ++ && sib.st_ino == sob.st_ino ++ /* POSIX emulating systems may support stat() but if the ++ underlying file system does not support a file serial number ++ of some kind then they will return 0 for the inode. So ++ two files with an inode of 0 may not actually be the same. ++ On real POSIX systems no ordinary file will ever have an ++ inode of 0. */ ++ && sib.st_ino != 0 ++ /* Different files may have the same inode number if they ++ reside on different devices, so check the st_dev field as ++ well. */ ++ && sib.st_dev == sob.st_dev) + { +- if (sib.st_ino == sob.st_ino && sib.st_ino != 0) +- { +- /* Don't let as_fatal remove the output file! */ +- out_file_name = NULL; +- as_fatal (_("The input and output files must be distinct")); +- } ++ const char *saved_out_file_name = out_file_name; ++ ++ /* Don't let as_fatal remove the output file! */ ++ out_file_name = NULL; ++ as_fatal (_("The input '%s' and output '%s' files are the same"), ++ argv[i], saved_out_file_name); + } + } + } diff --git a/binutils.spec b/binutils.spec index de90f7a..a9de087 100644 --- a/binutils.spec +++ b/binutils.spec @@ -75,7 +75,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.31.1 -Release: 19%{?dist} +Release: 20%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -119,11 +119,6 @@ Patch03: binutils-2.31-export-demangle.h.patch # order. Patch04: binutils-2.22.52.0.4-no-config-h-check.patch -# Purpose: Import H.J.Lu's Kernel LTO patch. -# Lifetime: Permanent, but needs continual updating. -# FIXME: Try removing.... -# Patch05: binutils-2.26-lto.patch - # Purpose: Include the filename concerned in readelf error messages. This # makes readelf's output more helpful when it is run on multiple # input files. @@ -222,6 +217,10 @@ Patch24: binutils-gold-discard-version-info.patch # Lifetime: Fixed in 2.32 Patch25: binutils-CVE-2018-20002.patch +# Purpose: Fix assembler check for an output file matching an input file. +# Lifetime: Fixed in 2.32 +Patch26: binutils-gas-input-matches-output.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -369,6 +368,7 @@ using libelf instead of BFD. %patch23 -p1 %patch24 -p1 %patch25 -p1 +%patch26 -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 ? @@ -692,9 +692,8 @@ fi %{_bindir}/%{?cross}ld.bfd %{ld_bfd_priority} %{_sbindir}/alternatives --install %{_bindir}/%{?cross}ld %{?cross}ld \ %{_bindir}/%{?cross}ld.gold %{ld_gold_priority} -if [ $1 = 0 ]; then - %{_sbindir}/alternatives --auto %{?cross}ld -fi +# Do not run "alternatives --auto ld" here. Leave the setting to +# however the user previously had it set. See BZ 1592069 for more details. %endif # both ld.gold and ld.bfd %if %{isnative} @@ -797,6 +796,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Wed Jan 30 2019 Nick Clifton - 2.31.1-20 +- Fix the assembler's check that the output file is not also one of the input files. (#1660279) + * Thu Jan 03 2019 Nick Clifton - 2.31.1-19 - Fix a memory leak reading minisymbols. (#1661535)