[PATCH] Implement `internal_start/join_thread` on Mac OS X

Alexander Potapenko glider at google.com
Tue May 19 03:21:09 PDT 2015


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:340
@@ +339,3 @@
+void *internal_start_thread(void(*func)(void *arg), void *arg) {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+  // Start the thread with signals blocked, otherwise it can steal user signals.
----------------
ismailp wrote:
> glider wrote:
> > Why is this disabled on certain iOS versions?
> > Do we really need TSan on iOS? (note that the shadow memory overhead is quite big and the 32-bit address space may be too little).
> I didn't try porting TSan to iOS, but I thought about trying it out for iPhone 6, which has 64-bit processor. I have no idea whether this is possible, as I didn't investigate it in detail.
> 
> We must get it working reliably on Mac OS X first. Therefore, it might be better to replace this line with:
>   #if TARGET_OS_MAC && !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
Agreed.

================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:341
@@ +340,3 @@
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+  // Start the thread with signals blocked, otherwise it can steal user signals.
+  __sanitizer_sigset_t set, old;
----------------
Looks like you've taken this from sanitizer_linux.cc
Can you please move this function to sanitizer_posix.cc instead?

================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:346
@@ +345,3 @@
+  void *th;
+  real_pthread_create(&th, 0, (void*(*)(void *arg))func, arg);
+  internal_sigprocmask(SIG_SETMASK, &old, 0);
----------------
I think we need a __sanitizer_pthread_t declaration somewhere. No need to add it right now though.

http://reviews.llvm.org/D9638

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list