Revert "[Asan] Accept __lsan_ignore_object for redzone pointer"
authorVitaly Buka <vitalybuka@google.com>
Wed, 16 Sep 2020 07:27:13 +0000 (00:27 -0700)
committerVitaly Buka <vitalybuka@google.com>
Wed, 16 Sep 2020 07:34:43 +0000 (00:34 -0700)
We still keep AddrIsInside.

This reverts commit 1d70984fa220f966ddcecd7906c5f10368fe1b93.

compiler-rt/lib/asan/asan_allocator.cpp
compiler-rt/test/asan/TestCases/lsan_annotations.cpp

index 691f64c..58b496a 100644 (file)
@@ -1172,8 +1172,10 @@ void ForEachChunk(ForEachChunkCallback callback, void *arg) {
 IgnoreObjectResult IgnoreObjectLocked(const void *p) {
   uptr addr = reinterpret_cast<uptr>(p);
   __asan::AsanChunk *m = __asan::instance.GetAsanChunkByAddr(addr);
-  if (!m || (atomic_load(&m->chunk_state, memory_order_acquire) !=
-             __asan::CHUNK_ALLOCATED)) {
+  if (!m ||
+      (atomic_load(&m->chunk_state, memory_order_acquire) !=
+       __asan::CHUNK_ALLOCATED) ||
+      !m->AddrIsInside(addr)) {
     return kIgnoreObjectInvalid;
   }
   if (m->lsan_tag == kIgnored)
index ce7c19b..158c2fd 100644 (file)
@@ -5,7 +5,7 @@
 #include <sanitizer/lsan_interface.h>
 #include <stdlib.h>
 
-int *x, *y, *z;
+int *x, *y;
 
 int main() {
   x = new int;
@@ -16,9 +16,6 @@ int main() {
     y = new int;
   }
 
-  z = new int;
-  __lsan_ignore_object(z - 1);
-
-  x = y = z = nullptr;
+  x = y = nullptr;
   return 0;
 }