[compiler-rt] 0b2c0dc - [ASan] Remove sanity checks during annotation of contiguous container

Advenam Tacet via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 21:07:11 PDT 2023


Author: Advenam Tacet
Date: 2023-06-27T06:07:03+02:00
New Revision: 0b2c0dc63faa51835b864f1277f4d5ddffc49f6c

URL: https://github.com/llvm/llvm-project/commit/0b2c0dc63faa51835b864f1277f4d5ddffc49f6c
DIFF: https://github.com/llvm/llvm-project/commit/0b2c0dc63faa51835b864f1277f4d5ddffc49f6c.diff

LOG: [ASan] Remove sanity checks during annotation of contiguous container

This revision removes sanity checks in
`__sanitizer_annotate_contiguous_container`.
(Changed them to `DCHECK_EQ`.)
Those checks may be problematic, if someone manually unpoisoned memory block.
Manual unpoisoning may be used if part of the program is not
instrumented.

Those checks are helpful while confirming correctness of ASan annotations
implementation.

Originally suggested here: https://reviews.llvm.org/D136765#4174546

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D145482

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_poisoning.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_poisoning.cpp b/compiler-rt/lib/asan/asan_poisoning.cpp
index 5164b7d860f48..e99b91d9c0a7e 100644
--- a/compiler-rt/lib/asan/asan_poisoning.cpp
+++ b/compiler-rt/lib/asan/asan_poisoning.cpp
@@ -449,11 +449,11 @@ void __sanitizer_annotate_contiguous_container(const void *beg_p,
   // FIXME: Two of these three checks are disabled until we fix
   // https://github.com/google/sanitizers/issues/258.
   // if (d1 != d2)
-  //  CHECK_EQ(*(u8*)MemToShadow(d1), old_mid - d1);
+  //  DCHECK_EQ(*(u8*)MemToShadow(d1), old_mid - d1);
   if (a + granularity <= d1)
-    CHECK_EQ(*(u8 *)MemToShadow(a), 0);
+    DCHECK_EQ(*(u8 *)MemToShadow(a), 0);
   // if (d2 + granularity <= c && c <= end)
-  //   CHECK_EQ(*(u8 *)MemToShadow(c - granularity),
+  //   DCHECK_EQ(*(u8 *)MemToShadow(c - granularity),
   //            kAsanContiguousContainerOOBMagic);
 
   uptr b1 = RoundDownTo(new_end, granularity);


        


More information about the llvm-commits mailing list