[compiler-rt] 63458d9 - [asan] Block signals only on platforms with implementation
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 16:13:36 PDT 2023
Author: Vitaly Buka
Date: 2023-07-26T16:13:24-07:00
New Revision: 63458d92e524f00b8a3614b5772c270151b049e8
URL: https://github.com/llvm/llvm-project/commit/63458d92e524f00b8a3614b5772c270151b049e8
DIFF: https://github.com/llvm/llvm-project/commit/63458d92e524f00b8a3614b5772c270151b049e8.diff
LOG: [asan] Block signals only on platforms with implementation
Followup to D156299.
Added:
Modified:
compiler-rt/lib/asan/asan_interceptors.cpp
compiler-rt/lib/asan/asan_posix.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index 7c0225103e41de..e939307371bb88 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -224,9 +224,12 @@ static thread_return_t THREAD_CALLING_CONV asan_thread_start(void *arg) {
auto args = asanThreadArgRetval().GetArgs(self);
t->ThreadStart(GetTid());
+# if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \
+ SANITIZER_SOLARIS
__sanitizer_sigset_t sigset;
t->GetStartData(sigset);
SetSigProcMask(&sigset, nullptr);
+# endif
thread_return_t retval = (*args.routine)(args.arg_retval);
asanThreadArgRetval().Finish(self, retval);
@@ -249,7 +252,10 @@ INTERCEPTOR(int, pthread_create, void *thread, void *attr,
u32 current_tid = GetCurrentTidOrInvalid();
__sanitizer_sigset_t sigset;
+# if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \
+ SANITIZER_SOLARIS
ScopedBlockSignals block(&sigset);
+# endif
AsanThread *t = AsanThread::Create(sigset, current_tid, &stack, detached);
diff --git a/compiler-rt/lib/asan/asan_posix.cpp b/compiler-rt/lib/asan/asan_posix.cpp
index 50b1a8448bd480..e1f66641617cc1 100644
--- a/compiler-rt/lib/asan/asan_posix.cpp
+++ b/compiler-rt/lib/asan/asan_posix.cpp
@@ -138,7 +138,8 @@ void PlatformTSDDtor(void *tsd) {
CHECK_EQ(0, pthread_setspecific(tsd_key, tsd));
return;
}
-# if SANITIZER_LINUX
+# if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \
+ SANITIZER_SOLARIS
// After this point it's unsafe to execute signal handlers which may be
// instrumented. It's probably not just a Linux issue.
BlockSignals();
More information about the llvm-commits
mailing list