public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] ARM cmse_scan segfault
Date: Thu, 21 Nov 2019 11:18:00 -0000	[thread overview]
Message-ID: <73d5efd7e13ebd8fe87278224bc2ae777af3de52@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 73d5efd7e13ebd8fe87278224bc2ae777af3de52 ***

commit 73d5efd7e13ebd8fe87278224bc2ae777af3de52
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Thu Nov 21 08:57:00 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Thu Nov 21 21:08:30 2019 +1030

    ARM cmse_scan segfault
    
    This code in elf_link_add_object_symbols:
    
          ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
          if (ret < 0)
            goto error_return;
    
          /* If we have already included this dynamic object in the
             link, just ignore it.  There is no reason to include a
             particular dynamic object more than once.  */
          if (ret > 0)
            return TRUE;
    
    prevents a shared library from being loaded twice by ensuring that any
    library soname doesn't match the soname of one already loaded.  This
    happens before sym_hashes are allocated, which leaves sym_hashes NULL.
    
    cmse_scan looks at library symbols, and when attempting to look up a
    global symbol will segfault if sym_hashes is zero.
    
            * elf32-arm.c (elf32_arm_size_stubs): Exclude dynamic library
            BFDs that have not been loaded.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ffe527c52a..a1ef734af6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-21  Alan Modra  <amodra@gmail.com>
+
+	* elf32-arm.c (elf32_arm_size_stubs): Exclude dynamic library
+	BFDs that have not been loaded.
+
 2019-11-19  Alan Modra  <amodra@gmail.com>
 
 	PR 25197
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index f27ee42183..dca208f06a 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6527,8 +6527,11 @@ elf32_arm_size_stubs (bfd *output_bfd,
 	  asection *section;
 	  Elf_Internal_Sym *local_syms = NULL;
 
-	  if (!is_arm_elf (input_bfd)
-	      || (elf_dyn_lib_class (input_bfd) & DYN_AS_NEEDED) != 0)
+	  if (!is_arm_elf (input_bfd))
+	    continue;
+	  if ((input_bfd->flags & DYNAMIC) != 0
+	      && (elf_sym_hashes (input_bfd) == NULL
+		  || (elf_dyn_lib_class (input_bfd) & DYN_AS_NEEDED) != 0))
 	    continue;
 
 	  num_a8_relocs = 0;


             reply	other threads:[~2019-11-21 11:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 11:18 gdb-buildbot [this message]
2019-11-21 11:18 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
2019-11-21 11:33 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-11-27 17:34 ` Failures on Fedora-i686, " gdb-buildbot
2019-11-27 17:47 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-11-27 17:50 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-11-27 18:15 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-11-27 18:22 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-11-27 18:27 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-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=73d5efd7e13ebd8fe87278224bc2ae777af3de52@gdb-build \
    --to=gdb-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).