]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Leak tls key 0
authorVMware, Inc <>
Thu, 27 Oct 2011 18:44:00 +0000 (11:44 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 27 Oct 2011 18:44:00 +0000 (11:44 -0700)
We have a couple of bugs that show system libraries on linux have a
nasty habit of destroying the first TLS key, even if they don't own it.
This is due to using uninitialized global variables (which default to
zero).  Rather than expose ourselves to the blame for such bugs,
let's just leak the key.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/misc/vthreadBase.c

index 64ae08ac44da53c52b93db7fb058350953103cb8..28b23ad3bf2eedaa0fcee2389ea68af539a0d6e2 100644 (file)
@@ -394,6 +394,15 @@ VThreadBaseGetKey(void)
 #else
       Bool success = pthread_key_create(&newKey, 
                                         &VThreadBaseSafeDeleteTLS) == 0;
+      if (success && newKey == 0) {
+         /* 
+          * Leak TLS key 0.  System libraries have a habit of destroying
+          * it.  See bugs 702818 and 773420.
+          */
+
+         success = pthread_key_create(&newKey, 
+                                      &VThreadBaseSafeDeleteTLS) == 0;
+      }
       ASSERT_NOT_IMPLEMENTED(success);
 #endif