[compiler-rt] r191066 - tsan: do not crash when user intercepts fopen()

Dmitry Vyukov dvyukov at google.com
Thu Sep 19 19:01:38 PDT 2013


Author: dvyukov
Date: Thu Sep 19 21:01:38 2013
New Revision: 191066

URL: http://llvm.org/viewvc/llvm-project?rev=191066&view=rev
Log:
tsan: do not crash when user intercepts fopen()


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=191066&r1=191065&r2=191066&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Thu Sep 19 21:01:38 2013
@@ -1751,7 +1751,11 @@ TSAN_INTERCEPTOR(int, getaddrinfo, void
   // and can report false race between malloc and free
   // inside of getaddrinfo. So ignore memory accesses.
   ThreadIgnoreBegin(thr);
+  // getaddrinfo calls fopen, which can be intercepted by user.
+  thr->in_rtl--;
+  CHECK_EQ(thr->in_rtl, 0);
   int res = REAL(getaddrinfo)(node, service, hints, rv);
+  thr->in_rtl++;
   ThreadIgnoreEnd(thr);
   return res;
 }





More information about the llvm-commits mailing list