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

Kostya Serebryany kcc at google.com
Thu Oct 17 02:49:45 PDT 2013



================
Comment at: lib/asan/asan_allocator2.cc:219
@@ -218,1 +218,3 @@
   }
+  // Must be called when holding the allocator lock.
+  void *AllocBegLocked() {
----------------
Alexey Samsonov wrote:
> 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.
These are actually a bit different.
allocator.GetBlockBeginFastLocked is a completely different code than allocator.GetBlockBegin

================
Comment at: lib/sanitizer_common/sanitizer_allocator.h:1310
@@ +1309,3 @@
+  void AssertLockHeld() {
+    secondary_.AssertLockHeld();
+  }
----------------
Alexey Samsonov wrote:
> The absence of "primary_.AssertLockHeld()" kind of breaks the pattern. Maybe we should implement it as "return true;" for lock-free allocators?
dunno. OTOH  primary_.AssertLockHeld() may confuse because the reader will assume there is a lock.


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



More information about the llvm-commits mailing list