[compiler-rt] b1fd009 - [scudo] GWP_ASAN runs on untagged pointers

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 20:41:40 PDT 2021


Author: Vitaly Buka
Date: 2021-06-30T20:41:30-07:00
New Revision: b1fd009aab4bfe4f16bd78b7ac779c3f665ae060

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

LOG: [scudo] GWP_ASAN runs on untagged pointers

It's already covered by multiple tests, but to trigger
this path we need MTE+GWP which disabled.

Reviewed By: hctim, pcc

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

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/combined.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 079edab1875b7..e8bb8bf207be7 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -569,9 +569,6 @@ class Allocator {
       reportAllocationSizeTooBig(NewSize, 0, MaxAllowedMallocSize);
     }
 
-    void *OldTaggedPtr = OldPtr;
-    OldPtr = getHeaderTaggedPointer(OldPtr);
-
     // The following cases are handled by the C wrappers.
     DCHECK_NE(OldPtr, nullptr);
     DCHECK_NE(NewSize, 0);
@@ -591,6 +588,9 @@ class Allocator {
     }
 #endif // GWP_ASAN_HOOKS
 
+    void *OldTaggedPtr = OldPtr;
+    OldPtr = getHeaderTaggedPointer(OldPtr);
+
     if (UNLIKELY(!isAligned(reinterpret_cast<uptr>(OldPtr), MinAlignment)))
       reportMisalignedPointer(AllocatorAction::Reallocating, OldPtr);
 


        


More information about the llvm-commits mailing list