From 680ffe3c09b953ed76906c0f1db114b9d2c57975 Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Tue, 1 Oct 2024 11:10:49 -0700 Subject: [PATCH] [scudo] Fix isOwned on MTE devices. If called on address that is actually not owned, the tags could not match. Disable tag checks in isOwned(). --- compiler-rt/lib/scudo/standalone/combined.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h index a5f1bc388e882..88fdc5943d6f8 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;