Fix an internal error loading an object file that needs an incompatible plugin.

Resolves: #1311320
This commit is contained in:
Nick Clifton 2016-03-01 08:35:51 +00:00
parent 90851841a5
commit 22f22bc705
2 changed files with 52 additions and 1 deletions

43
binutils-rh1311320.patch Normal file
View File

@ -0,0 +1,43 @@
diff -rup binutils-2.25.orig/bfd/hash.c binutils-2.25/bfd/hash.c
--- binutils-2.25.orig/bfd/hash.c 2016-03-01 08:08:16.065426095 +0000
+++ binutils-2.25/bfd/hash.c 2016-03-01 08:18:16.678210068 +0000
@@ -423,6 +423,8 @@ bfd_hash_table_init (struct bfd_hash_tab
void
bfd_hash_table_free (struct bfd_hash_table *table)
{
+ if (table->memory == NULL)
+ return;
objalloc_free ((struct objalloc *) table->memory);
table->memory = NULL;
}
diff -rup binutils-2.25.orig/bfd/plugin.c binutils-2.25/bfd/plugin.c
--- binutils-2.25.orig/bfd/plugin.c 2016-03-01 08:08:16.076426138 +0000
+++ binutils-2.25/bfd/plugin.c 2016-03-01 08:09:56.776828118 +0000
@@ -345,6 +345,10 @@ try_load_plugin (const char *pname, bfd
int i;
ld_plugin_onload onload;
enum ld_plugin_status status;
+ static bfd_boolean loading = FALSE;
+
+ if (loading)
+ goto err;
plugin_handle = dlopen (pname, RTLD_NOW);
if (!plugin_handle)
@@ -378,12 +382,16 @@ try_load_plugin (const char *pname, bfd
if (status != LDPS_OK)
goto err;
+ loading = TRUE;
+
if (!claim_file)
goto err;
if (!try_claim (abfd))
goto err;
+ loading = FALSE;
+
return 1;
err:

View File

@ -19,7 +19,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.25
Release: 16%{?dist}
Release: 17%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -63,6 +63,9 @@ Patch17: binutils-2.25.1-dynamic_list.patch
Patch18: binutils-2.25-aarch64-pr18668.patch
# Fix internal linker error processing IFUNC relocations in debug sections.
Patch19: binutils-rh1309763.patch
# Fix seg-fault loading a binary that needs an incompatible plugin.
Patch20: binutils-rh1311320.patch
Provides: bundled(libiberty)
@ -190,6 +193,7 @@ using libelf instead of BFD.
%patch17 -p1 -b .dynamic_list~
%patch18 -p1
%patch19 -p1
%patch20 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -503,6 +507,10 @@ exit 0
%endif # %{isnative}
%changelog
* Tue Mar 01 2016 Nick Clifton <nickc@redhat.com> 2.25-17
- Fix an internal error loading an object file that needs an incompatible plugin.
(#1311320)
* Fri Feb 19 2016 Nick Clifton <nickc@redhat.com> 2.25-16
- Fix an internal error linking object files with IFUNC relocations in debug sections.
(#1309763)