From 0d9b7bc9ad0b620dde5020cb046dcdd5c437a4b8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 4 Apr 2016 10:52:59 +0000 Subject: [PATCH] tsan: fix ignore handling in signal handlers We've reset thr->ignore_reads_and_writes, but forget to do thr->fast_state.ClearIgnoreBit(). So ignores were not effective reset and fast_state.ignore_bit was corrupted if signal handler itself uses ignores. Properly reset/restore fast_state.ignore_bit around signal handlers. llvm-svn: 265288 --- compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index 2b84632..6bddc3f 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -1887,6 +1887,7 @@ static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire, int ignore_sync = thr->ignore_sync; if (!ctx->after_multithreaded_fork) { thr->ignore_reads_and_writes = 0; + thr->fast_state.ClearIgnoreBit(); thr->ignore_interceptors = 0; thr->ignore_sync = 0; } @@ -1907,6 +1908,8 @@ static void CallUserSignalHandler(ThreadState *thr, bool sync, bool acquire, } if (!ctx->after_multithreaded_fork) { thr->ignore_reads_and_writes = ignore_reads_and_writes; + if (ignore_reads_and_writes) + thr->fast_state.SetIgnoreBit(); thr->ignore_interceptors = ignore_interceptors; thr->ignore_sync = ignore_sync; } -- 2.7.4