From 39f928ed01fde8604515421c5438c3ecb537fbf2 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 4 Jun 2021 11:25:47 -0700 Subject: [PATCH] [scudo] Remove disableMemoryTagChecksTestOnly And replace with ScopedDisableMemoryTagChecks. Differential Revision: https://reviews.llvm.org/D103708 --- compiler-rt/lib/scudo/standalone/memtag.h | 24 ---------------------- .../lib/scudo/standalone/tests/combined_test.cpp | 7 ++----- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/memtag.h b/compiler-rt/lib/scudo/standalone/memtag.h index 26502e2..13e9939 100644 --- a/compiler-rt/lib/scudo/standalone/memtag.h +++ b/compiler-rt/lib/scudo/standalone/memtag.h @@ -116,22 +116,6 @@ inline void enableSystemMemoryTaggingTestOnly() { #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 @@ inline void enableSystemMemoryTaggingTestOnly() { 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 index 983e9b4..50b55bb 100644 --- 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 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, DisableMemoryTagging) { // 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 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, DisableMemoryTagging) { Allocator->deallocate(P, Origin); Allocator->releaseToOS(); - - // Disabling memory tag checks may interfere with subsequent tests. - // Re-enable them now. - scudo::enableMemoryTagChecksTestOnly(); } } -- 2.7.4