summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_interceptors.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2013-09-21 23:06:00 +0000
committerDmitry Vyukov <dvyukov@google.com>2013-09-21 23:06:00 +0000
commitd18865339cebcdaa9fc720a1e960cb452f330835 (patch)
tree95ec11c01ac45944cad92e24e983e5fd5fc7b40f /lib/tsan/rtl/tsan_interceptors.cc
parentfcb6c9c80f06c241801d22d2258f59e7bb828e7b (diff)
downloadcompiler-rt-d18865339cebcdaa9fc720a1e960cb452f330835.tar.gz
compiler-rt-d18865339cebcdaa9fc720a1e960cb452f330835.tar.bz2
compiler-rt-d18865339cebcdaa9fc720a1e960cb452f330835.tar.xz
tsan: ignore all interceptors coming directly from JVM
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_interceptors.cc')
-rw-r--r--lib/tsan/rtl/tsan_interceptors.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/tsan/rtl/tsan_interceptors.cc b/lib/tsan/rtl/tsan_interceptors.cc
index 0338f5a7..e5bc5331 100644
--- a/lib/tsan/rtl/tsan_interceptors.cc
+++ b/lib/tsan/rtl/tsan_interceptors.cc
@@ -128,6 +128,21 @@ struct SignalContext {
int pending_signal_count;
SignalDesc pending_signals[kSigCount];
};
+
+// Used to ignore interceptors coming directly from libjvm.so.
+atomic_uintptr_t libjvm_begin;
+atomic_uintptr_t libjvm_end;
+
+static bool libjvm_check(uptr pc) {
+ uptr begin = atomic_load(&libjvm_begin, memory_order_relaxed);
+ if (begin != 0 && pc >= begin) {
+ uptr end = atomic_load(&libjvm_end, memory_order_relaxed);
+ if (end != 0 && pc < end)
+ return true;
+ }
+ return false;
+}
+
} // namespace __tsan
static SignalContext *SigCtx(ThreadState *thr) {
@@ -191,7 +206,7 @@ ScopedInterceptor::~ScopedInterceptor() {
Printf("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \
Die(); \
} \
- if (thr->in_rtl > 1) \
+ if (thr->in_rtl > 1 || libjvm_check(pc)) \
return REAL(func)(__VA_ARGS__); \
/**/