This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/pr14370 created. glibc-2.16-ports-merge-279-gdae6f91
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 5 Sep 2012 13:46:43 -0000
- Subject: GNU C Library master sources branch hjl/pr14370 created. glibc-2.16-ports-merge-279-gdae6f91
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pr14370 has been created
at dae6f911e3f44ce05bda41d89d77cd74ff9213ac (commit)
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=dae6f911e3f44ce05bda41d89d77cd74ff9213ac
commit dae6f911e3f44ce05bda41d89d77cd74ff9213ac
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Sep 4 13:18:28 2012 -0700
Check mismatched TLS/non-TLS symbols
diff --git a/ChangeLog b/ChangeLog
index 5411be3..838c607 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14370]
+ * elf/dl-lookup.c (_dl_lookup_symbol_x): Check mismatched
+ TLS/non-TLS symbols.
+
2012-09-04 Florian Weimer <fweimer@redhat.com>
* stdlib/tst-secure-getenv.c (alternative_main): Only warn on SGID
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index e7f7148..85bfb51 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -840,6 +840,31 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
? undef_map->l_scope : symbol_scope,
version, type_class, flags, skip_map);
+ if (__builtin_expect (*ref != NULL, 1)
+ && (__builtin_expect (ELFW(ST_TYPE) (current_value.s->st_info) == STT_TLS, 0)
+ || __builtin_expect (ELFW(ST_TYPE) ((*ref)->st_info) == STT_TLS, 0))
+ && __builtin_expect (ELFW(ST_TYPE) (current_value.s->st_info) !=
+ ELFW(ST_TYPE) ((*ref)->st_info), 1))
+ {
+ const char *reference_name = undef_map ? undef_map->l_name : "";
+ const char *definition_name = (current_value.m->l_name[0]
+ ? current_value.m->l_name
+ : rtld_progname);
+ _dl_signal_cerror (0, (reference_name[0]
+ ? reference_name
+ : (rtld_progname ?: "<main program>")),
+ N_("symbol lookup error"),
+ make_string ((ELFW(ST_TYPE) ((*ref)->st_info) == STT_TLS
+ ? "TLS" : "non-TLS"),
+ " definition `", undef_name,
+ "' mismatches ",
+ (ELFW(ST_TYPE) (current_value.s->st_info) == STT_TLS
+ ? "TLS" : "non-TLS"),
+ " reference in ", definition_name));
+ *ref = NULL;
+ return 0;
+ }
+
/* The object is used. */
if (__builtin_expect (current_value.m->l_used == 0, 0))
current_value.m->l_used = 1;
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources