[PATCH] D38854: [scudo] Allow for non-Android Shared TSD platforms, part 2

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 16:59:16 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/scudo/scudo_platform.h:26
 // Android and Fuchsia use a pool of TSDs shared between threads.
-# define SCUDO_TSD_EXCLUSIVE 0
-#elif SANITIZER_LINUX && !SANITIZER_ANDROID
+#  define SCUDO_TSD_EXCLUSIVE 0
+# elif SANITIZER_LINUX && !SANITIZER_ANDROID
----------------
What's going to happen if we define SCUDO_TSD_EXCLUSIVE at compile time on these platforms?


================
Comment at: lib/scudo/scudo_tsd_shared.cpp:21
 static pthread_once_t GlobalInitialized = PTHREAD_ONCE_INIT;
-static pthread_key_t PThreadKey;
+pthread_key_t PThreadKey;
 
----------------
Why is it not static anymore?


================
Comment at: lib/scudo/scudo_tsd_shared.cpp:35
 static void initOnce() {
-  // Hack: TLS_SLOT_TSAN was introduced in N. To be able to use it on M for
-  // testing, we create an unused key. Since the key_data array follows the tls
-  // array, it basically gives us the extra entry we need.
-  // TODO(kostyak): remove and restrict to N and above.
   CHECK_EQ(pthread_key_create(&PThreadKey, NULL), 0);
   initScudo();
----------------
You do not need this PThreadKey on Android, right? Maybe it does make sense to separate implementations along these lines? Move PThreadKey and Android into separate cpp files and link what you need?


https://reviews.llvm.org/D38854





More information about the llvm-commits mailing list