[PATCH] [asan] Fix a deadlock between asan's allocator and lsan

Alexey Samsonov samsonov at google.com
Thu Oct 17 02:44:49 PDT 2013



================
Comment at: lib/asan/asan_allocator2.cc:219
@@ -218,1 +218,3 @@
   }
+  // Must be called when holding the allocator lock.
+  void *AllocBegLocked() {
----------------
Why not make "Locked" a parameter (m.b. with default value =false) of AllocBeg(), UsedSize(), AddrIsInside() instead of duplicating code? I think inlining will help us to avoid slowdown.

================
Comment at: lib/sanitizer_common/sanitizer_allocator.h:1310
@@ +1309,3 @@
+  void AssertLockHeld() {
+    secondary_.AssertLockHeld();
+  }
----------------
The absence of "primary_.AssertLockHeld()" kind of breaks the pattern. Maybe we should implement it as "return true;" for lock-free allocators?


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



More information about the llvm-commits mailing list