[compiler-rt] [scudo] Fix isOwned on MTE devices. (PR #110717)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 11:15:38 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Evgenii Stepanov (eugenis)

<details>
<summary>Changes</summary>

If called on address that is actually not owned, the tags could not match. Disable tag checks in isOwned().

---
Full diff: https://github.com/llvm/llvm-project/pull/110717.diff


1 Files Affected:

- (modified) compiler-rt/lib/scudo/standalone/combined.h (+2) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/110717


More information about the llvm-commits mailing list