[compiler-rt] r174184 - tsan: catch races on fd in more cases
Dmitry Vyukov
dvyukov at google.com
Fri Feb 1 07:52:35 PST 2013
Author: dvyukov
Date: Fri Feb 1 09:52:35 2013
New Revision: 174184
URL: http://llvm.org/viewvc/llvm-project?rev=174184&view=rev
Log:
tsan: catch races on fd in more cases
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=174184&r1=174183&r2=174184&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Fri Feb 1 09:52:35 2013
@@ -595,6 +595,8 @@ TSAN_INTERCEPTOR(void*, mmap, void *addr
return MAP_FAILED;
void *res = REAL(mmap)(addr, sz, prot, flags, fd, off);
if (res != MAP_FAILED) {
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
MemoryResetRange(thr, pc, (uptr)res, sz);
}
return res;
@@ -607,6 +609,8 @@ TSAN_INTERCEPTOR(void*, mmap64, void *ad
return MAP_FAILED;
void *res = REAL(mmap64)(addr, sz, prot, flags, fd, off);
if (res != MAP_FAILED) {
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
MemoryResetRange(thr, pc, (uptr)res, sz);
}
return res;
@@ -1150,21 +1154,29 @@ TSAN_INTERCEPTOR(int, lstat64, const cha
TSAN_INTERCEPTOR(int, __fxstat, int version, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat, version, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
return REAL(__fxstat)(version, fd, buf);
}
TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
return REAL(__fxstat)(0, fd, buf);
}
TSAN_INTERCEPTOR(int, __fxstat64, int version, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat64, version, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
return REAL(__fxstat64)(version, fd, buf);
}
TSAN_INTERCEPTOR(int, fstat64, int fd, void *buf) {
SCOPED_TSAN_INTERCEPTOR(__fxstat64, 0, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
return REAL(__fxstat64)(0, fd, buf);
}
More information about the llvm-commits
mailing list