diff --git a/compiler-rt/lib/msan/msan_thread.h b/compiler-rt/lib/msan/msan_thread.h --- a/compiler-rt/lib/msan/msan_thread.h +++ b/compiler-rt/lib/msan/msan_thread.h @@ -15,7 +15,7 @@ #include "msan_allocator.h" #include "sanitizer_common/sanitizer_common.h" - +#include "sanitizer_common/sanitizer_posix.h" namespace __msan { class MsanThread { @@ -69,6 +69,8 @@ unsigned in_signal_handler_; + __sanitizer_sigset_t sigset_; + MsanThreadLocalMallocStorage malloc_storage_; }; diff --git a/compiler-rt/lib/msan/msan_thread.cpp b/compiler-rt/lib/msan/msan_thread.cpp --- a/compiler-rt/lib/msan/msan_thread.cpp +++ b/compiler-rt/lib/msan/msan_thread.cpp @@ -1,8 +1,12 @@ -#include "msan.h" #include "msan_thread.h" -#include "msan_interface_internal.h" +#include + +#include "msan.h" +#include "msan_interface_internal.h" +#include "sanitizer_common/sanitizer_linux.h" +#include "sanitizer_common/sanitizer_posix.h" #include "sanitizer_common/sanitizer_tls_get_addr.h" namespace __msan { @@ -16,6 +20,10 @@ thread->arg_ = arg; thread->destructor_iterations_ = GetPthreadDestructorIterations(); + __sanitizer_sigset_t set; + internal_sigfillset(&set); + CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, &set, &thread->sigset_)); + return thread; } @@ -47,6 +55,8 @@ CHECK(MEM_IS_APP(stack_.bottom)); CHECK(MEM_IS_APP(stack_.top - 1)); ClearShadowForThreadStackAndTLS(); + + CHECK_EQ(0, internal_sigprocmask(SIG_SETMASK, &sigset_, nullptr)); } void MsanThread::TSDDtor(void *tsd) {