[compiler-rt] 39f928e - [scudo] Remove disableMemoryTagChecksTestOnly

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 4 12:38:41 PDT 2021


Author: Vitaly Buka
Date: 2021-06-04T12:38:29-07:00
New Revision: 39f928ed01fde8604515421c5438c3ecb537fbf2

URL: https://github.com/llvm/llvm-project/commit/39f928ed01fde8604515421c5438c3ecb537fbf2
DIFF: https://github.com/llvm/llvm-project/commit/39f928ed01fde8604515421c5438c3ecb537fbf2.diff

LOG: [scudo] Remove disableMemoryTagChecksTestOnly

And replace with ScopedDisableMemoryTagChecks.

Differential Revision: https://reviews.llvm.org/D103708

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/memtag.h
    compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/memtag.h b/compiler-rt/lib/scudo/standalone/memtag.h
index 26502e2b1bade..13e9939cae758 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 983e9b48ad2de..50b55bb089f1c 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<char *>(P)[2048] = 0xaa, "");
-    scudo::disableMemoryTagChecksTestOnly();
+    scudo::ScopedDisableMemoryTagChecks NoTagChecks;
     Allocator->disableMemoryTagging();
     reinterpret_cast<char *>(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();
   }
 }
 


        


More information about the llvm-commits mailing list