public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] MIPS64/BFD: Fix a crash with STN_UNDEF in relocation
Date: Mon, 09 Apr 2018 13:12:00 -0000	[thread overview]
Message-ID: <aec2e0d252342aa7575aff608e999a36f27a9147@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT aec2e0d252342aa7575aff608e999a36f27a9147 ***

Author: Maciej W. Rozycki <macro@mips.com>
Branch: master
Commit: aec2e0d252342aa7575aff608e999a36f27a9147

MIPS64/BFD: Fix a crash with STN_UNDEF in relocation

Prevent a null BFD pointer dereference and a resulting segmentation
fault in `mips_elf64_write_rel' or `mips_elf64_write_rela':

Program received signal SIGSEGV, Segmentation fault.
0x0000000000437690 in mips_elf64_write_rela (abfd=0x71e130, sec=0x720700,
    rela_hdr=0x721ff8, count=0x7fffffffb82c, data=0x7fffffffb88c)
    at .../bfd/elf64-mips.c:4123
4123	      if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
4124		  && ! _bfd_elf_validate_reloc (abfd, ptr))

in the MIPS64 (n64 MIPS) ELF backend whenever the STN_UNDEF symbol index
is retrieved from the `r_sym' field of a relocation seen in input while
running `objcopy' or `strip'.  The reason for the null BFD pointer is
that internally in BFD an STN_UNDEF symbol reference resolves to an
absolute zero symbol that does not have a BFD associated.  Check the
pointer then before using it, like the generic ELF backend does in
`elf_write_relocs'.

This complements the same change made for generic ELF bundled with:

commit e35765a9a2eaff0df62757f3e6480c8ba5ab8ee8
Author: Ian Lance Taylor <ian@airs.com>
Date:   Sun Dec 15 19:59:18 1996 +0000

which (obviously due to a CVS -> GIT repository conversion inaccuracy)
seems to be one corresponding to this ChangeLog entry:

	* elfcode.h (write_relocs): Handle absolute symbol.

from:

commit c86158e591edd8450f49f8cd75f82e4313d4b6d8
Author: Ian Lance Taylor <ian@airs.com>
Date:   Fri Aug 30 22:09:51 1996 +0000

("Add SH ELF support."), which also updated RELA only and not REL (which
has been since fixed with: commit 947216bf8f34 ("ELF reloc code tidy"),
<https://sourceware.org/ml/binutils/2002-11/msg00727.html>).

	bfd/
	* elf64-mips.c (mips_elf64_write_rel): Handle a NULL BFD pointer
	in the BFD symbol referred by the relocation.
	(mips_elf64_write_rela): Likewise.


             reply	other threads:[~2018-04-09 13:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09 13:12 sergiodj+buildbot [this message]
2018-04-09 13:12 ` Failures on RHEL-s390x-m64, branch master sergiodj+buildbot
2018-04-09 13:28 ` Failures on Fedora-s390x-m64, " sergiodj+buildbot
2018-04-09 14:35 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-04-09 14:51 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-04-09 14:52 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-w64-mingw32, branch master *** BREAKAGE *** sergiodj+buildbot
2018-04-09 15:28 ` Failures on Fedora-x86_64-cc-with-index, branch master sergiodj+buildbot
2018-04-09 15:53 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-04-09 22:53 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-04-09 23:23 ` Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot
2018-04-09 23:54 ` Failures on Ubuntu-AArch32-m32, " sergiodj+buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aec2e0d252342aa7575aff608e999a36f27a9147@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).