Skip to content

Commit 362d263

Browse files
authored
[tsan] Process SIGPROF as sync signal only if thread is alive (#86343)
Otherwise it may crash too early. This is followup to #85188
1 parent 0ba678a commit 362d263

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,8 +2169,7 @@ static bool is_sync_signal(ThreadSignalContext *sctx, int sig,
21692169
return false;
21702170
#endif
21712171
return sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || sig == SIGTRAP ||
2172-
sig == SIGABRT || sig == SIGFPE || sig == SIGPIPE || sig == SIGSYS ||
2173-
sig == SIGPROF;
2172+
sig == SIGABRT || sig == SIGFPE || sig == SIGPIPE || sig == SIGSYS;
21742173
}
21752174

21762175
void sighandler(int sig, __sanitizer_siginfo *info, void *ctx) {
@@ -2181,7 +2180,8 @@ void sighandler(int sig, __sanitizer_siginfo *info, void *ctx) {
21812180
return;
21822181
}
21832182
// Don't mess with synchronous signals.
2184-
const bool sync = is_sync_signal(sctx, sig, info);
2183+
const bool sync = is_sync_signal(sctx, sig, info) ||
2184+
(sig == SIGPROF && thr->is_inited && !thr->is_dead);
21852185
if (sync ||
21862186
// If we are in blocking function, we can safely process it now
21872187
// (but check if we are in a recursive interceptor,

0 commit comments

Comments
 (0)