[compiler-rt] r265288 - tsan: fix ignore handling in signal handlers

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 03:52:59 PDT 2016


Author: dvyukov
Date: Mon Apr  4 05:52:59 2016
New Revision: 265288

URL: http://llvm.org/viewvc/llvm-project?rev=265288&view=rev
Log:
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.


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=265288&r1=265287&r2=265288&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Mon Apr  4 05:52:59 2016
@@ -1887,6 +1887,7 @@ static void CallUserSignalHandler(Thread
   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(Thread
   }
   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;
   }




More information about the llvm-commits mailing list