public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug dynamic-link/14370] SIGFPE in 'ldd -r'
Date: Sun, 02 Sep 2012 22:57:00 -0000	[thread overview]
Message-ID: <bug-14370-131-xpvCVDEkJM@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14370-131@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=14370

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> 2012-09-02 22:57:15 UTC ---
We can add check like:

diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 33847f0..e09b413 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -388,6 +388,11 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel
*reloc,
           {
 # ifndef RTLD_BOOTSTRAP
 #  ifndef SHARED
+        if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) != STT_NOTYPE,
+                      1)
+            && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) != STT_TLS,
+                     1))
+          goto non_tls;
         CHECK_STATIC_TLS (map, sym_map);
 #  else
         if (!TRY_STATIC_TLS (map, sym_map))
@@ -418,6 +423,11 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel
*reloc,
          block we subtract the offset from that of the TLS block.  */
       if (sym != NULL)
         {
+          if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) != STT_NOTYPE,
+                    1)
+          && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) != STT_TLS,
+                       1))
+        goto non_tls;
           CHECK_STATIC_TLS (map, sym_map);
           *reloc_addr += sym_map->l_tls_offset - sym->st_value;
         }
@@ -433,6 +443,11 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel
*reloc,
          thread pointer.  */
       if (sym != NULL)
         {
+          if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) != STT_NOTYPE,
+                    1)
+          && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) != STT_TLS,
+                    1))
+        goto non_tls;
           CHECK_STATIC_TLS (map, sym_map);
           *reloc_addr += sym->st_value - sym_map->l_tls_offset;
         }
@@ -476,6 +491,20 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel
*reloc,
       break;
 # endif    /* !RTLD_BOOTSTRAP */
     }
+
+# ifndef RTLD_BOOTSTRAP
+      return;
+
+non_tls:
+    {
+      const char *strtab;
+      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
+      _dl_error_printf ("\
+                reloc type 0x%x against non-TLS symbol `%s' in %s\n",
+                r_type, strtab + refsym->st_name,
+                rtld_progname ?: "<program name unknown>");
+    }
+# endif
     }
 }

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2012-09-02 22:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 10:05 [Bug dynamic-link/14370] New: " pluto at agmk dot net
2012-07-18 10:11 ` [Bug dynamic-link/14370] " aj at suse dot de
2012-07-18 10:49 ` pluto at agmk dot net
2012-07-18 10:54 ` jakub at redhat dot com
2012-07-18 11:00 ` pluto at agmk dot net
2012-07-18 12:37 ` pluto at agmk dot net
2012-07-24  2:04 ` carlos_odonell at mentor dot com
2012-07-24  6:14 ` pluto at agmk dot net
2012-09-02 20:00 ` hjl.tools at gmail dot com
2012-09-02 22:57 ` hjl.tools at gmail dot com [this message]
2012-09-03  2:54 ` bugdal at aerifal dot cx
2012-09-03 13:39 ` carlos_odonell at mentor dot com
2012-09-03 15:29 ` pluto at agmk dot net
2012-09-03 18:59 ` hjl.tools at gmail dot com
2012-09-03 20:07 ` aj at suse dot de
2012-09-04 19:09 ` [Bug dynamic-link/14370] ld.so crashes on mismatched TLS/non-TLS symbols hjl.tools at gmail dot com
2012-09-04 19:41 ` carlos_odonell at mentor dot com
2012-09-04 21:32 ` hjl.tools at gmail dot com
2012-09-04 22:03 ` carlos_odonell at mentor dot com
2012-09-04 22:15 ` bugdal at aerifal dot cx
2012-09-04 22:22 ` hjl.tools at gmail dot com
2012-09-04 23:26 ` bugdal at aerifal dot cx
2012-09-05 15:24 ` ppluzhnikov at google dot com
2012-09-05 15:30 ` hjl.tools at gmail dot com
2012-12-04  0:00 ` carlos at systemhalted dot org
2013-10-02 22:44 ` neleai at seznam dot cz
2014-06-17 18:59 ` fweimer at redhat dot com
2023-07-30 16:53 ` sam at gentoo dot org

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=bug-14370-131-xpvCVDEkJM@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /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).