[compiler-rt] r197982 - tsan: fix false positive in pthread stack manupulation

Dmitry Vyukov dvyukov at google.com
Tue Dec 24 06:38:12 PST 2013


Author: dvyukov
Date: Tue Dec 24 08:38:12 2013
New Revision: 197982

URL: http://llvm.org/viewvc/llvm-project?rev=197982&view=rev
Log:
tsan: fix false positive in pthread stack manupulation
pthread uses internal cache, we do not see synchronization in it


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=197982&r1=197981&r2=197982&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Tue Dec 24 08:38:12 2013
@@ -880,7 +880,9 @@ TSAN_INTERCEPTOR(int, pthread_create,
   {
     // Otherwise we see false positives in pthread stack manipulation.
     ScopedIgnoreInterceptors ignore;
+    ThreadIgnoreBegin(thr, pc);
     res = REAL(pthread_create)(th, attr, __tsan_thread_start_func, &p);
+    ThreadIgnoreEnd(thr, pc);
   }
   if (res == 0) {
     int tid = ThreadCreate(thr, pc, *(uptr*)th, detached);
@@ -897,7 +899,9 @@ TSAN_INTERCEPTOR(int, pthread_create,
 TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) {
   SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret);
   int tid = ThreadTid(thr, pc, (uptr)th);
+  ThreadIgnoreBegin(thr, pc);
   int res = BLOCK_REAL(pthread_join)(th, ret);
+  ThreadIgnoreEnd(thr, pc);
   if (res == 0) {
     ThreadJoin(thr, pc, tid);
   }





More information about the llvm-commits mailing list