[compiler-rt] r193519 - tsan: start the background thread with signals blocked, otherwise it can steal users signals

Dmitry Vyukov dvyukov at google.com
Mon Oct 28 05:29:33 PDT 2013


Author: dvyukov
Date: Mon Oct 28 07:29:32 2013
New Revision: 193519

URL: http://llvm.org/viewvc/llvm-project?rev=193519&view=rev
Log:
tsan: start the background thread with signals blocked, otherwise it can steal users signals


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=193519&r1=193518&r2=193519&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Mon Oct 28 07:29:32 2013
@@ -2191,9 +2191,15 @@ void InitializeInterceptors() {
 }
 
 void internal_start_thread(void(*func)(void *arg), void *arg) {
+  // Start the thread with signals blocked, otherwise it can steal users
+  // signals.
+  __sanitizer_kernel_sigset_t set, old;
+  internal_sigfillset(&set);
+  internal_sigprocmask(SIG_SETMASK, &set, &old);
   void *th;
   REAL(pthread_create)(&th, 0, (void*(*)(void *arg))func, arg);
   REAL(pthread_detach)(th);
+  internal_sigprocmask(SIG_SETMASK, &old, 0);
 }
 
 }  // namespace __tsan





More information about the llvm-commits mailing list