[PATCH] Call __asan_free_hook() before marking the chunk quarantinned

Alexey Samsonov samsonov at google.com
Tue Jun 4 04:33:14 PDT 2013



================
Comment at: lib/asan/asan_allocator2.cc:519
@@ -525,1 +518,3 @@
   if (new_ptr) {
+    ASAN_FREE_HOOK(old_ptr);
+    // Must mark the chunk as quarantined before any changes to its metadata.
----------------
Timur Iskhodzhanov wrote:
> This should be after `memcpy` as the user's hook may fill the buffer with 0xDEADBEEF
Done

================
Comment at: lib/asan/lit_tests/malloc_hook_ownership.cc:24
@@ +23,3 @@
+  volatile int *x = new int;
+  // CHECK: MallocHook
+  *x = 0;
----------------
Kostya Serebryany wrote:
> I'd check that the hooks get the correct pointer
> 
> CHECK: MallocHook [[ADDR]]
I've merged this lit test with existing one. Done there.


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



More information about the llvm-commits mailing list