[compiler-rt] 362d263 - [tsan] Process SIGPROF as sync signal only if thread is alive (#86343)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 15:24:48 PDT 2024
Author: Vitaly Buka
Date: 2024-03-22T15:24:44-07:00
New Revision: 362d26366d0175f01ffb6085eb747a6e40f01147
URL: https://github.com/llvm/llvm-project/commit/362d26366d0175f01ffb6085eb747a6e40f01147
DIFF: https://github.com/llvm/llvm-project/commit/362d26366d0175f01ffb6085eb747a6e40f01147.diff
LOG: [tsan] Process SIGPROF as sync signal only if thread is alive (#86343)
Otherwise it may crash too early.
This is followup to #85188
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 2bebe651b994e5..810ce69663d050 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -2169,8 +2169,7 @@ static bool is_sync_signal(ThreadSignalContext *sctx, int sig,
return false;
#endif
return sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || sig == SIGTRAP ||
- sig == SIGABRT || sig == SIGFPE || sig == SIGPIPE || sig == SIGSYS ||
- sig == SIGPROF;
+ sig == SIGABRT || sig == SIGFPE || sig == SIGPIPE || sig == SIGSYS;
}
void sighandler(int sig, __sanitizer_siginfo *info, void *ctx) {
@@ -2181,7 +2180,8 @@ void sighandler(int sig, __sanitizer_siginfo *info, void *ctx) {
return;
}
// Don't mess with synchronous signals.
- const bool sync = is_sync_signal(sctx, sig, info);
+ const bool sync = is_sync_signal(sctx, sig, info) ||
+ (sig == SIGPROF && thr->is_inited && !thr->is_dead);
if (sync ||
// If we are in blocking function, we can safely process it now
// (but check if we are in a recursive interceptor,
More information about the llvm-commits
mailing list