[compiler-rt] r184404 - [ASan] Clear allocation magic value before recycling the chunk. This led to spurious crashes in LSan when it walked through reused chunks. Don't know how to create not-brittle test case for this.

Alexey Samsonov samsonov at google.com
Thu Jun 20 01:13:06 PDT 2013


Author: samsonov
Date: Thu Jun 20 03:13:06 2013
New Revision: 184404

URL: http://llvm.org/viewvc/llvm-project?rev=184404&view=rev
Log:
[ASan] Clear allocation magic value before recycling the chunk. This led to spurious crashes in LSan when it walked through reused chunks. Don't know how to create not-brittle test case for this.

Modified:
    compiler-rt/trunk/lib/asan/asan_allocator2.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=184404&r1=184403&r2=184404&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Thu Jun 20 03:13:06 2013
@@ -280,6 +280,9 @@ struct QuarantineCallback {
     if (p != m) {
       uptr *alloc_magic = reinterpret_cast<uptr *>(p);
       CHECK_EQ(alloc_magic[0], kAllocBegMagic);
+      // Clear the magic value, as allocator internals may overwrite the
+      // contents of deallocated chunk, confusing GetAsanChunk lookup.
+      alloc_magic[0] = 0;
       CHECK_EQ(alloc_magic[1], reinterpret_cast<uptr>(m));
     }
 





More information about the llvm-commits mailing list