public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Re: PR26656, power10 libstdc++.so segfault in __cxxabiv1::__cxa_throw
Date: Mon, 28 Sep 2020 09:45:37 +0930	[thread overview]
Message-ID: <20200928001537.GA6741@bubble.grove.modra.org> (raw)
In-Reply-To: <20200923224137.GH5452@bubble.grove.modra.org>

Some missing NULL checks meant a stub for a local symbol used a stub
looking like the __tls_get_addr_opt stub.

	PR 26656
	* elf64-ppc.c (ppc_build_one_stub, ppc_size_one_stub): Check for
	NULL stub_entry->h before calling is_tls_get_addr.

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 4194802d48..35f3cbef1e 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -11678,6 +11678,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
       obfd = htab->params->stub_bfd;
       is_tga = ((stub_entry->stub_type == ppc_stub_plt_call_notoc
 		 || stub_entry->stub_type == ppc_stub_plt_call_both)
+		&& stub_entry->h != NULL
 		&& is_tls_get_addr (&stub_entry->h->elf, htab)
 		&& htab->params->tls_get_addr_opt);
       if (is_tga)
@@ -12188,7 +12189,8 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
     case ppc_stub_plt_call_notoc:
     case ppc_stub_plt_call_both:
       lr_used = 0;
-      if (is_tls_get_addr (&stub_entry->h->elf, htab)
+      if (stub_entry->h != NULL
+	  && is_tls_get_addr (&stub_entry->h->elf, htab)
 	  && htab->params->tls_get_addr_opt)
 	{
 	  lr_used += 7 * 4;
@@ -12258,6 +12260,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 	}
       if ((stub_entry->stub_type == ppc_stub_plt_call_notoc
 	   || stub_entry->stub_type == ppc_stub_plt_call_both)
+	  && stub_entry->h != NULL
 	  && is_tls_get_addr (&stub_entry->h->elf, htab)
 	  && htab->params->tls_get_addr_opt)
 	{

-- 
Alan Modra
Australia Development Lab, IBM

      reply	other threads:[~2020-09-28  0:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 22:41 Alan Modra
2020-09-28  0:15 ` Alan Modra [this message]

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=20200928001537.GA6741@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@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).