tsan: start the background thread with signals blocked, otherwise it can steal users signals

llvm-svn: 193519
This commit is contained in:
Dmitry Vyukov 2013-10-28 12:29:32 +00:00
parent 981fdeb477
commit 33dd200ba9
1 changed files with 6 additions and 0 deletions

View File

@ -2191,9 +2191,15 @@ void InitializeInterceptors() {
} }
void internal_start_thread(void(*func)(void *arg), void *arg) { 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; void *th;
REAL(pthread_create)(&th, 0, (void*(*)(void *arg))func, arg); REAL(pthread_create)(&th, 0, (void*(*)(void *arg))func, arg);
REAL(pthread_detach)(th); REAL(pthread_detach)(th);
internal_sigprocmask(SIG_SETMASK, &old, 0);
} }
} // namespace __tsan } // namespace __tsan