[compiler-rt] 119146f - [hwasan] do not check if freed pointer belonged to allocator.

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 02:13:02 PDT 2021


Author: Florian Mayer
Date: 2021-08-20T10:12:47+01:00
New Revision: 119146f8ae25c31ea630a15761a6fba6b7eb909c

URL: https://github.com/llvm/llvm-project/commit/119146f8ae25c31ea630a15761a6fba6b7eb909c
DIFF: https://github.com/llvm/llvm-project/commit/119146f8ae25c31ea630a15761a6fba6b7eb909c.diff

LOG: [hwasan] do not check if freed pointer belonged to allocator.

In that case it is very likely that there will be a tag mismatch anyway.

We handle the case that the pointer belongs to neither of the allocators
by getting a nullptr from allocator.GetBlockBegin.

Reviewed By: hctim, eugenis

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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_allocator.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 63d86cf99e582..3e7271f93fb61 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -208,8 +208,7 @@ static bool PointerAndMemoryTagsMatch(void *tagged_ptr) {
 static bool CheckInvalidFree(StackTrace *stack, void *untagged_ptr,
                              void *tagged_ptr) {
   // This function can return true if halt_on_error is false.
-  if (!allocator.PointerIsMine(untagged_ptr) ||
-      !PointerAndMemoryTagsMatch(tagged_ptr)) {
+  if (!PointerAndMemoryTagsMatch(tagged_ptr)) {
     ReportInvalidFree(stack, reinterpret_cast<uptr>(tagged_ptr));
     return true;
   }


        


More information about the llvm-commits mailing list