[llvm-commits] [PATCH] Refactor asan memory quarantine.

Kostya Serebryany kcc at google.com
Thu Jan 10 23:50:01 PST 2013



================
Comment at: asan/asan_allocator2.cc:245
@@ +244,3 @@
+static AsanQuarantine quarantine(LINKER_INITIALIZED);
+static QuarantineCache quarantineCache(LINKER_INITIALIZED);
+static AllocatorCache allocatorCache;
----------------
global_quarantine_cache? 
or 
fallback_quarantine_cache? 

================
Comment at: asan/asan_allocator2.cc:246
@@ +245,3 @@
+static QuarantineCache quarantineCache(LINKER_INITIALIZED);
+static AllocatorCache allocatorCache;
+static SpinMutex quarantineMutex;
----------------
ditto


================
Comment at: asan/asan_allocator2.cc:247
@@ +246,3 @@
+static AllocatorCache allocatorCache;
+static SpinMutex quarantineMutex;
+
----------------
is this the right name for this lock?

also, these files use another naming convention. 

================
Comment at: asan/asan_allocator2.cc:250
@@ +249,3 @@
+QuarantineCache *GetQuarantineCache(AsanThreadLocalMallocStorage *ms) {
+  DCHECK(ms);
+  DCHECK_LE(sizeof(QuarantineCache), sizeof(ms->quarantine_cache));
----------------
Don't use DCHECKs, use CHECKs
The problems is that they only fire on debug builds and we don't have a bot with debug builds

================
Comment at: asan/asan_allocator2.cc:284
@@ +283,3 @@
+  void *Allocate(uptr size) {
+    return allocator.Allocate(cache_, size, sizeof(cache_), false);
+  }
----------------
just use 0 as alignment

================
Comment at: sanitizer_common/sanitizer_quarantine.h:79
@@ +78,3 @@
+
+  void Enqueue(Node *ptr) {
+    size_ += ptr->UsedSize();
----------------
can you use sanitizer_common/sanitizer_list.h here?
or just implement the right thing (no list) :) 


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



More information about the llvm-commits mailing list