Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 326273 - Thread local storage miscompiles
Summary: Thread local storage miscompiles
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-30 08:39 UTC by Łukasz Michalik
Modified: 2015-07-04 15:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
minimal testcase (tls.cc,572 bytes, text/plain)
2010-06-30 08:40 UTC, Łukasz Michalik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Łukasz Michalik 2010-06-30 08:39:51 UTC
Reproducable only on x86 hardened with PIE enabled and at least -O2.
Comment 1 Łukasz Michalik 2010-06-30 08:40:31 UTC
Created attachment 237007 [details]
minimal testcase
Comment 2 Magnus Granberg gentoo-dev 2010-07-01 00:23:36 UTC
The only change we have done it in the TLS code so it behave as the gcc 3.4.6
did else you may get soemthing like this
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.3/../../../../x86_64-pc-linux-gnu/bin/ld: ../../lib/libuuid.a(gen_uuid.o): relocation R_X86_64_TPOFF32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC ../../lib/libuuid.a: could not read symbols: Bad value
see more in
http://bugs.gentoo.org/show_bug.cgi?id=232601
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00923.html
The code change
@@ -5607,7 +5607,11 @@
   bool is_local;
 
   is_local = targetm.binds_local_p (decl);
-  if (!flag_shlib)
+  #ifdef ENABLE_ESP
+    if (!flag_pic)
+  #else
+    if (!flag_shlib)
+  #endif
     {
       if (is_local)
 	kind = TLS_MODEL_LOCAL_EXEC;