[vm] Unpoison memory before zapping. Zapping is applied to the whole segment, not just what had been allocated, and the unallocated portion is poisoned. TEST=debug asan Change-Id: I2e0d42f97dda4d38fc2579b54d8e171ee88098fe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309781 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Brian Quinlan <bquinlan@google.com>
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc index 47a42ab..a6d62c4 100644 --- a/runtime/vm/zone.cc +++ b/runtime/vm/zone.cc
@@ -101,6 +101,7 @@ #ifdef DEBUG // Zap the entire allocated segment (including the header). + ASAN_UNPOISON(reinterpret_cast<void*>(result), size); memset(reinterpret_cast<void*>(result), kZapUninitializedByte, size); #endif ASAN_POISON(reinterpret_cast<void*>(result), size); @@ -125,6 +126,7 @@ VirtualMemory* memory = current->memory(); #ifdef DEBUG // Zap the entire current segment (including the header). + ASAN_UNPOISON(reinterpret_cast<void*>(current), current->size()); memset(reinterpret_cast<void*>(current), kZapDeletedByte, current->size()); #endif ASAN_POISON(reinterpret_cast<void*>(current), size); @@ -179,6 +181,7 @@ segments_ = nullptr; #ifdef DEBUG + ASAN_UNPOISON(&buffer_, kInitialChunkSize); memset(&buffer_, kZapDeletedByte, kInitialChunkSize); #endif ASAN_POISON(&buffer_, kInitialChunkSize);