Skip to content

Commit e45c6d5

Browse files
committed
tsan: disable trace switching after multithreaded fork
The problem is reported in: google/sanitizers#945 We already disable as much as possible after multithreaded fork, trace switching is last place that can hang due to basic operations (memory accesses, function calls). Disable it too. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331163 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 635ae70 commit e45c6d5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/tsan/rtl/tsan_rtl.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ u32 CurrentStackId(ThreadState *thr, uptr pc) {
547547
}
548548

549549
void TraceSwitch(ThreadState *thr) {
550+
#if !SANITIZER_GO
551+
if (ctx->after_multithreaded_fork)
552+
return;
553+
#endif
550554
thr->nomalloc++;
551555
Trace *thr_trace = ThreadTrace(thr->tid);
552556
Lock l(&thr_trace->mtx);

lib/tsan/rtl/tsan_rtl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ struct Context {
520520
Context();
521521

522522
bool initialized;
523+
#if !SANITIZER_GO
523524
bool after_multithreaded_fork;
525+
#endif
524526

525527
MetaMap metamap;
526528

0 commit comments

Comments
 (0)