[PATCH] tsan: ignore interceptors coming from specified libraries

Alexey Samsonov samsonov at google.com
Wed Oct 2 07:34:37 PDT 2013



================
Comment at: tsan/rtl/tsan_rtl.cc:217
@@ -216,1 +216,3 @@
 #ifndef TSAN_GO
+  InitializeLibIgnore();
+#endif
----------------
Why not put this under a single ifndef?

================
Comment at: tsan/rtl/tsan_interceptors.cc:169
@@ -171,1 +168,3 @@
+    , in_rtl_(thr->in_rtl)
+    , in_ignored_lib_() {
   if (thr_->in_rtl == 0) {
----------------
in_ingored_lib_(false)

================
Comment at: tsan/rtl/tsan_interceptors.cc:130
@@ -128,13 +129,3 @@
 
-// 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;
+static uptr libignore_placeholder[sizeof(LibIgnore) / sizeof(uptr) + 1];
+static LibIgnore *libignore() {
----------------
* do you need to use ALIGNED(64) here?
* why not static char [sizeof(LibIgnore)]?

================
Comment at: tsan/lit_tests/ignore_lib0.cc:1
@@ +1,2 @@
+// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o ./Output/libignore_lib0.so
+// RUN: %clangxx_tsan -O1 %s -L./Output/ -lignore_lib0 -o %t
----------------
Please use %p and %t wildcards (see asan/lit_tests/TestCases/dlclose-test.cc as an example)

================
Comment at: tsan/lit_tests/ignore_lib0.cc:4
@@ +3,3 @@
+// RUN: LD_LIBRARY_PATH=./Output/ not %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP
+// RUN: LD_LIBRARY_PATH=./Output/ TSAN_OPTIONS=suppressions=%s.supp not %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
+
----------------
TSAN_OPTIONS=$TSAN_OPTIONS:....

================
Comment at: sanitizer_common/sanitizer_suppressions.h:46
@@ -44,2 +45,3 @@
   void GetMatched(InternalMmapVector<Suppression *> *matched);
+  const InternalMmapVector<Suppression> *GetSuppressions() const;
 
----------------
Can we do better than return the class internals to the caller?

================
Comment at: sanitizer_common/sanitizer_libignore.h:41
@@ +40,3 @@
+ private:
+  struct Lib {
+    char *name;
----------------
Consider reusing LoadedModule from sanitizer_common.h


http://llvm-reviews.chandlerc.com/D1808



More information about the llvm-commits mailing list