* Snapshot, taken from the 2.31 branch (20180710).
- Fix PR ld/23388, configuration with --enable-separate-code on i386. Closes: #903376.
- Fix PR ld/23372, Remove x86 ISA properties with empty bits.
- Fix PR binutils/23369, read/write flag for these registers on AArch64.
- Fix PR binutils/23242, SBO bit in disassembly mask for ldrah on AArch64.
- [GOLD] PowerPC .gnu.attributes support.
- CVE-2018-8945: PR binutils/22809, objdump segfault.
Matthias Klose [Fri, 22 Jun 2018 06:11:21 +0000 (07:11 +0100)]
pr23055
# DP: Fix PR ld/23055, memory corruption in ld.
bfd/
2018-04-17 Nick Clifton <nickc@redhat.com>
PR 23055
* aoutx.h (find_nearest_line): Check that the symbol name exists
and is long enough, before attempting to see if it is for a .o
file.
* hash.c (bfd_hash_hash): Add an assertion that the string is not
NULL.
* linker.c (bfd_link_hash_lookup): Fail if the table or string are
NULL.
(_bfd_generic_link_add_archive_symbols): Fail if an archive entry
has no name.
2018-04-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23055
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Use a
normal input file with compatible relocation.
Matthias Klose [Fri, 22 Jun 2018 06:11:21 +0000 (07:11 +0100)]
pr23054
# DP: Fix PR binutils/23054, memory corruption in as.
gas/
2018-04-16 Nick Clifton <nickc@redhat.com>
PR 23054
* cond.c (s_ifsef): Replace use of obstack_copy with obstack_alloc
followed by memcpy.
(s_if, s_ifb, s_ifc, s_ifeqs): Likewise.
* obj-elf.c (elf_adjust_symtab): Check for local symbols before
attempting to dereference the sy_next field of a symbol.
* stabs.c (get_stab_string_offset): Fail if there is no string
following the stab directive.
James Cowgill [Thu, 1 Mar 2018 11:55:18 +0000 (11:55 +0000)]
PR22770: MIPS: Fix GOT page counter in multi-got links
The record_got_page_entry function records and updates the maximum
number of GOT page entries which may be required by an object. In the
case where an existing GOT page entry was expanded, only the entry
belonging to the master GOT would have its page count updated. This leaves
the entry belonging to the object GOT with the num_pages count of 1 it
was originally initialized with. Later on when GOTs are being merged in a
multi-got link, this causes the value of entry->num_pages in
add_got_page_entries to always be 1 and underestimates the number of pages
required for the new entry. This in turn leads to an assertion failure in
get_got_page_offset where we run out of pages.
Fix by not inserting Got_page_entrys into the object's GOT at all and
later on adding the total number of page entries recorded for the
object's GOT into the new merged GOT. This is safe because
got_page_entries_ is used for no other purpose in the object's GOT, and
page_gotno_ for the object's GOT should already be incremented by the correct
amount in record_got_page_entry. Remove Got_page_entry::num_pages which
is now unused.
gold/
2018-03-01 James Cowgill <james.cowgill@mips.com>
PR gold/22770
* mips.cc (Mips_got_info::record_got_page_entry): Don't insert
Got_page_entry for object's GOT.
(Mips_got_info::add_got_page_entries): Add all pages from from's GOT.
Rename to add_got_page_count.
(Got_page_entry): Remove num_pages.
Matthias Klose [Fri, 22 Jun 2018 06:11:21 +0000 (07:11 +0100)]
pr22905
# DP: Prevent illegal memory accesses triggered by integer overflow
# DP: when parsing corrupt DWARF information on a 32-bit host.
From d11ae95ea3403559f052903ab053f43ad7821e37 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Thu, 1 Mar 2018 16:14:08 +0000
Subject: [PATCH] Prevent illegal memory accesses triggered by integer overflow
when parsing corrupt DWARF information on a 32-bit host.
PR 22905
* dwarf.c (display_debug_ranges): Check that the offset loaded
from the range_entry structure is valid.
Matthias Klose [Fri, 22 Jun 2018 06:11:21 +0000 (07:11 +0100)]
pr22895
# DP: Catch integer overflows/underflows when parsing corrupt DWARF FORM blocks.
From 12c963421d045a127c413a0722062b9932c50aa9 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 28 Feb 2018 11:50:49 +0000
Subject: [PATCH] Catch integer overflows/underflows when parsing corrupt DWARF
FORM blocks.
PR 22895
PR 22893
* dwarf2.c (read_n_bytes): Replace size parameter with dwarf_block
pointer. Drop unused abfd parameter. Check the size of the block
before initialising the data field. Return the end pointer if the
size is invalid.
(read_attribute_value): Adjust invocations of read_n_bytes.
Nick Clifton [Tue, 6 Feb 2018 15:48:29 +0000 (15:48 +0000)]
Prevent attempts to call strncpy with a zero-length field by chacking the size of debuglink sections.
PR 22794
* opncls.c (bfd_get_debug_link_info_1): Check the size of the
section before attempting to read it in.
(bfd_get_alt_debug_link_info): Likewise.
Matthias Klose [Fri, 22 Jun 2018 06:11:21 +0000 (07:11 +0100)]
pr22734
# DP: Fix PR binutils/22734, taken from the trunk.
2018-01-30 Nick Clifton <nickc@redhat.com>
PR 22734
* doc/binutils.texi (nm): Update description to point out that
zero-initialized values can also be shown as type B, b, S or s
since they can be stored in the BSS section.
Matthias Klose [Tue, 29 May 2018 13:46:35 +0000 (14:46 +0100)]
pr23055
# DP: Fix PR ld/23055, memory corruption in ld.
bfd/
2018-04-17 Nick Clifton <nickc@redhat.com>
PR 23055
* aoutx.h (find_nearest_line): Check that the symbol name exists
and is long enough, before attempting to see if it is for a .o
file.
* hash.c (bfd_hash_hash): Add an assertion that the string is not
NULL.
* linker.c (bfd_link_hash_lookup): Fail if the table or string are
NULL.
(_bfd_generic_link_add_archive_symbols): Fail if an archive entry
has no name.
2018-04-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23055
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Use a
normal input file with compatible relocation.
Matthias Klose [Tue, 29 May 2018 13:46:35 +0000 (14:46 +0100)]
pr23054
# DP: Fix PR binutils/23054, memory corruption in as.
gas/
2018-04-16 Nick Clifton <nickc@redhat.com>
PR 23054
* cond.c (s_ifsef): Replace use of obstack_copy with obstack_alloc
followed by memcpy.
(s_if, s_ifb, s_ifc, s_ifeqs): Likewise.
* obj-elf.c (elf_adjust_symtab): Check for local symbols before
attempting to dereference the sy_next field of a symbol.
* stabs.c (get_stab_string_offset): Fail if there is no string
following the stab directive.