[compiler-rt] d1e5f04 - Revert "[NFC][scudo] Let disableMemoryTagChecksTestOnly to fail"

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue May 25 11:54:05 PDT 2021


Author: Vitaly Buka
Date: 2021-05-25T11:53:42-07:00
New Revision: d1e5f046cc9ca52301b3f5ed457272f84aa0da14

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

LOG: Revert "[NFC][scudo] Let disableMemoryTagChecksTestOnly to fail"

This reverts commit 2c212db4ea42fbbc0e83647da4f62261f775388b.

It's not needed.

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 5c3ea588da38..9773cb97f05d 100644
--- a/compiler-rt/lib/scudo/standalone/memtag.h
+++ b/compiler-rt/lib/scudo/standalone/memtag.h
@@ -92,13 +92,12 @@ inline bool systemDetectsMemoryTagFaultsTestOnly() { return false; }
 
 #endif // SCUDO_LINUX
 
-inline bool disableMemoryTagChecksTestOnly() {
+inline void disableMemoryTagChecksTestOnly() {
   __asm__ __volatile__(
       R"(
       .arch_extension memtag
       msr tco, #1
       )");
-  return true;
 }
 
 inline void enableMemoryTagChecksTestOnly() {
@@ -251,7 +250,7 @@ inline bool systemDetectsMemoryTagFaultsTestOnly() {
   UNREACHABLE("memory tagging not supported");
 }
 
-inline bool disableMemoryTagChecksTestOnly() {
+inline void disableMemoryTagChecksTestOnly() {
   UNREACHABLE("memory tagging not supported");
 }
 

diff  --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index 908c6354eab8..a5dcaed30ab6 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -399,20 +399,21 @@ 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, "");
-    if (scudo::disableMemoryTagChecksTestOnly()) {
-      Allocator->disableMemoryTagging();
-      reinterpret_cast<char *>(P)[2048] = 0xaa;
-      Allocator->deallocate(P, Origin);
+    scudo::disableMemoryTagChecksTestOnly();
+    Allocator->disableMemoryTagging();
+    reinterpret_cast<char *>(P)[2048] = 0xaa;
+    Allocator->deallocate(P, Origin);
 
-      P = Allocator->allocate(2048, Origin);
-      EXPECT_EQ(scudo::untagPointer(P), P);
-      reinterpret_cast<char *>(P)[2048] = 0xaa;
-      Allocator->deallocate(P, Origin);
+    P = Allocator->allocate(2048, Origin);
+    EXPECT_EQ(scudo::untagPointer(P), P);
+    reinterpret_cast<char *>(P)[2048] = 0xaa;
+    Allocator->deallocate(P, Origin);
 
-      // Disabling memory tag checks may interfere with subsequent tests.
-      // Re-enable them now.
-      scudo::enableMemoryTagChecksTestOnly();
-    }
+    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