diff --git a/compiler-rt/lib/scudo/standalone/memtag.h b/compiler-rt/lib/scudo/standalone/memtag.h --- a/compiler-rt/lib/scudo/standalone/memtag.h +++ b/compiler-rt/lib/scudo/standalone/memtag.h @@ -116,22 +116,6 @@ #endif // SCUDO_LINUX -inline void disableMemoryTagChecksTestOnly() { - __asm__ __volatile__( - R"( - .arch_extension memtag - msr tco, #1 - )"); -} - -inline void enableMemoryTagChecksTestOnly() { - __asm__ __volatile__( - R"( - .arch_extension memtag - msr tco, #0 - )"); -} - class ScopedDisableMemoryTagChecks { uptr PrevTCO; @@ -279,14 +263,6 @@ UNREACHABLE("memory tagging not supported"); } -inline void disableMemoryTagChecksTestOnly() { - UNREACHABLE("memory tagging not supported"); -} - -inline void enableMemoryTagChecksTestOnly() { - UNREACHABLE("memory tagging not supported"); -} - struct ScopedDisableMemoryTagChecks { ScopedDisableMemoryTagChecks() {} }; diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "memtag.h" #include "tests/scudo_unit_test.h" #include "allocator_config.h" @@ -398,7 +399,7 @@ // Check that disabling memory tagging works correctly. void *P = Allocator->allocate(2048, Origin); EXPECT_DEATH(reinterpret_cast(P)[2048] = 0xaa, ""); - scudo::disableMemoryTagChecksTestOnly(); + scudo::ScopedDisableMemoryTagChecks NoTagChecks; Allocator->disableMemoryTagging(); reinterpret_cast(P)[2048] = 0xaa; Allocator->deallocate(P, Origin); @@ -409,10 +410,6 @@ Allocator->deallocate(P, Origin); Allocator->releaseToOS(); - - // Disabling memory tag checks may interfere with subsequent tests. - // Re-enable them now. - scudo::enableMemoryTagChecksTestOnly(); } }