[PATCH] [asan] Move lsan_disabled out of thread context.

Alexey Samsonov samsonov at google.com
Fri Jun 21 05:47:20 PDT 2013


  Can you try to add a test for this (e.g. actually call __lsan_disable from tsd destrcutor)?


================
Comment at: lib/asan/asan_allocator2.cc:263
@@ +262,3 @@
+// __lsan_disable() from very strange places.
+THREADLOCAL int lsan_disabled;
+#endif
----------------
I think this variable belongs to lsan_common - it really has nothing to do with ASan. You may introduce a function lsan_is_ disabled_in_current_thread() to access it...

================
Comment at: lib/asan/asan_allocator2.cc:432
@@ -425,5 +431,3 @@
   }
-  if (t && t->lsan_disabled())
-    m->lsan_tag = __lsan::kIgnored;
-  else
-    m->lsan_tag = __lsan::kDirectlyLeaked;
+#if CAN_SANITIZE_LEAKS
+  if (lsan_disabled) m->lsan_tag = __lsan::kIgnored;
----------------
... and use lsan_is_disabled_in_current_thread() w/o #ifdefs here

================
Comment at: lib/asan/asan_allocator2.cc:803
@@ -797,3 +802,3 @@
 extern "C" {
 SANITIZER_INTERFACE_ATTRIBUTE
 void __lsan_disable() {
----------------
These functions can be moved to lsan_common as well


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



More information about the llvm-commits mailing list