Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 326273

Summary: Thread local storage miscompiles
Product: Gentoo Linux Reporter: Łukasz Michalik <lpmichalik>
Component: HardenedAssignee: The Gentoo Linux Hardened Team <hardened>
Status: RESOLVED OBSOLETE    
Severity: major CC: gibgibon
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: minimal testcase

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;