[PATCH] tsan: ignore interceptors coming from specified libraries

Alexey Samsonov samsonov at google.com
Thu Oct 3 01:01:52 PDT 2013



================
Comment at: sanitizer_common/sanitizer_libignore.h:27
@@ +26,3 @@
+
+class ALIGNED(64) LibIgnore {
+ public:
----------------
Dmitry Vyukov wrote:
> Kostya Serebryany wrote:
> > Will this work on Windows? (Check with Timur)
> It's not used on windows.
It is still compiled on Windows.

================
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
----------------
Dmitry Vyukov wrote:
> Alexey Samsonov wrote:
> > Please use %p and %t wildcards (see asan/lit_tests/TestCases/dlclose-test.cc as an example)
> I need to know the exact library name to put into suppressions file, I do not see how to handle this.
You can use %T wildcard for a temporary directory.

================
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() {
----------------
Dmitry Vyukov wrote:
> Dmitry Vyukov wrote:
> > Dmitry Vyukov wrote:
> > > Kostya Serebryany wrote:
> > > > Alexey Samsonov wrote:
> > > > > * do you need to use ALIGNED(64) here?
> > > > > * why not static char [sizeof(LibIgnore)]?
> > > > shouldn't this be aligned(64)? 
> > > > do you need to use ALIGNED(64) here?
> > > 
> > > The class itself is aligned.
> > > why not static char [sizeof(LibIgnore)]?
> > 
> > That does not provide necessary storage alignment -> undefined behavior.
> > shouldn't this be aligned(64)?
> 
> The class itself is aligned.
This deserves a careful comment or maybe even compiler check.

================
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) {
----------------
Dmitry Vyukov wrote:
> Alexey Samsonov wrote:
> > in_ingored_lib_(false)
> why?
I like to actually see the default value (and notice that in_ignored_lib_ is a bool). Not sure if it's consistent with conventions you use in TSan code.


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



More information about the llvm-commits mailing list