[Bug dynamic-link/14370] SIGFPE in 'ldd -r'
hjl.tools at gmail dot com
sourceware-bugzilla@sourceware.org
Sun Sep 2 22:57:00 GMT 2012
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.
More information about the Glibc-bugs
mailing list