[compiler-rt] 98c9523 - [scudo] Fix isOwned on MTE devices. (#110717)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct  1 12:49:01 PDT 2024
    
    
  
Author: Evgenii Stepanov
Date: 2024-10-01T12:48:56-07:00
New Revision: 98c9523113b550eaca3728bf30cbc346af5eff07
URL: https://github.com/llvm/llvm-project/commit/98c9523113b550eaca3728bf30cbc346af5eff07
DIFF: https://github.com/llvm/llvm-project/commit/98c9523113b550eaca3728bf30cbc346af5eff07.diff
LOG: [scudo] Fix isOwned on MTE devices. (#110717)
If called on an address that is actually not owned, the header tag might not
match. This would cause an MTE fault in Chunk::isValid.
Disable tag checks in isOwned().
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 a5f1bc388e8824..88fdc5943d6f81 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -785,6 +785,8 @@ class Allocator {
   // A corrupted chunk will not be reported as owned, which is WAI.
   bool isOwned(const void *Ptr) {
     initThreadMaybe();
+    // If the allocation is not owned, the tags could be wrong.
+    ScopedDisableMemoryTagChecks x;
 #ifdef GWP_ASAN_HOOKS
     if (GuardedAlloc.pointerIsMine(Ptr))
       return true;
        
    
    
More information about the llvm-commits
mailing list