[compiler-rt] r191074 - tsan: handle memory read/write in syscalls
Dmitry Vyukov
dvyukov at google.com
Thu Sep 19 23:54:14 PDT 2013
Author: dvyukov
Date: Fri Sep 20 01:54:14 2013
New Revision: 191074
URL: http://llvm.org/viewvc/llvm-project?rev=191074&view=rev
Log:
tsan: handle memory read/write in syscalls
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=191074&r1=191073&r2=191074&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Fri Sep 20 01:54:14 2013
@@ -1846,11 +1846,21 @@ struct TsanInterceptorContext {
#define COMMON_INTERCEPTOR_BLOCK_REAL(name) BLOCK_REAL(name)
#include "sanitizer_common/sanitizer_common_interceptors.inc"
-// FIXME: Implement these with MemoryAccessRange().
+static void syscall_access_range(uptr pc, uptr p, uptr s, bool write) {
+ ThreadState *thr = cur_thread();
+ if (thr->in_rtl == 0)
+ Initialize(thr);
+ thr->in_rtl++;
+ MemoryAccessRange(thr, pc, p, s, write);
+ thr->in_rtl--;
+ if (thr->in_rtl == 0)
+ ProcessPendingSignals(thr);
+}
+
#define COMMON_SYSCALL_PRE_READ_RANGE(p, s) \
- do { } while (false)
+ syscall_access_range(GET_CALLER_PC(), (uptr)(p), (uptr)(s), false)
#define COMMON_SYSCALL_PRE_WRITE_RANGE(p, s) \
- do { } while (false)
+ syscall_access_range(GET_CALLER_PC(), (uptr)(p), (uptr)(s), true)
#define COMMON_SYSCALL_POST_READ_RANGE(p, s) \
do { } while (false)
#define COMMON_SYSCALL_POST_WRITE_RANGE(p, s) \
More information about the llvm-commits
mailing list