[compiler-rt] r200742 - tsan: relax check for errno spoiling more

Dmitry Vyukov dvyukov at google.com
Mon Feb 3 23:10:45 PST 2014


Author: dvyukov
Date: Tue Feb  4 01:10:45 2014
New Revision: 200742

URL: http://llvm.org/viewvc/llvm-project?rev=200742&view=rev
Log:
tsan: relax check for errno spoiling more

We do not detect errno spoiling for SIGTERM,
because some SIGTERM handlers do spoil errno but reraise SIGTERM,
tsan reports false positive in such case.
It's difficult to properly detect this situation (reraise),
because in async signal processing case (when handler is called directly
from rtl_generic_sighandler) we have not yet received the reraised
signal; and it looks too fragile to intercept all ways to reraise a signal.


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=200742&r1=200741&r2=200742&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Tue Feb  4 01:10:45 2014
@@ -73,6 +73,7 @@ const int SIGABRT = 6;
 const int SIGFPE = 8;
 const int SIGSEGV = 11;
 const int SIGPIPE = 13;
+const int SIGTERM = 15;
 const int SIGBUS = 7;
 const int SIGSYS = 31;
 void *const MAP_FAILED = (void*)-1;
@@ -1642,7 +1643,14 @@ static void CallUserSignalHandler(Thread
     sigactions[sig].sa_sigaction(sig, info, uctx);
   else
     sigactions[sig].sa_handler(sig);
-  if (flags()->report_bugs && !sync && errno != 99) {
+  // We do not detect errno spoiling for SIGTERM,
+  // because some SIGTERM handlers do spoil errno but reraise SIGTERM,
+  // tsan reports false positive in such case.
+  // It's difficult to properly detect this situation (reraise),
+  // because in async signal processing case (when handler is called directly
+  // from rtl_generic_sighandler) we have not yet received the reraised
+  // signal; and it looks too fragile to intercept all ways to reraise a signal.
+  if (flags()->report_bugs && !sync && sig != SIGTERM && errno != 99) {
     Context *ctx = CTX();
     __tsan::StackTrace stack;
     stack.ObtainCurrent(thr, pc);





More information about the llvm-commits mailing list