[compiler-rt] 9c7fe12 - Revert "[scudo] Small cleanup of memory tagging code." (#167425)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 10 16:48:23 PST 2025
Author: Christopher Ferris
Date: 2025-11-10T16:48:19-08:00
New Revision: 9c7fe126f48f87c3cf73f4bc83a47820b320ed48
URL: https://github.com/llvm/llvm-project/commit/9c7fe126f48f87c3cf73f4bc83a47820b320ed48
DIFF: https://github.com/llvm/llvm-project/commit/9c7fe126f48f87c3cf73f4bc83a47820b320ed48.diff
LOG: Revert "[scudo] Small cleanup of memory tagging code." (#167425)
Reverts llvm/llvm-project#166860
The local static variable causes build failures.
Added:
Modified:
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/memtag.h
compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 2d0f4f53d2ac5..ffe9554203241 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -171,7 +171,8 @@ class Allocator {
Primary.Options.set(OptionBit::DeallocTypeMismatch);
if (getFlags()->delete_size_mismatch)
Primary.Options.set(OptionBit::DeleteSizeMismatch);
- if (systemSupportsMemoryTagging())
+ if (allocatorSupportsMemoryTagging<AllocatorConfig>() &&
+ systemSupportsMemoryTagging())
Primary.Options.set(OptionBit::UseMemoryTagging);
QuarantineMaxChunkSize =
diff --git a/compiler-rt/lib/scudo/standalone/memtag.h b/compiler-rt/lib/scudo/standalone/memtag.h
index 52897b3dca6ae..83ebe676433eb 100644
--- a/compiler-rt/lib/scudo/standalone/memtag.h
+++ b/compiler-rt/lib/scudo/standalone/memtag.h
@@ -66,8 +66,7 @@ inline bool systemSupportsMemoryTagging() {
#ifndef HWCAP2_MTE
#define HWCAP2_MTE (1 << 18)
#endif
- static bool SupportsMemoryTagging = getauxval(AT_HWCAP2) & HWCAP2_MTE;
- return SupportsMemoryTagging;
+ return getauxval(AT_HWCAP2) & HWCAP2_MTE;
}
inline bool systemDetectsMemoryTagFaultsTestOnly() {
@@ -262,7 +261,9 @@ inline uptr loadTag(uptr Ptr) {
#else
-inline bool systemSupportsMemoryTagging() { return false; }
+inline NORETURN bool systemSupportsMemoryTagging() {
+ UNREACHABLE("memory tagging not supported");
+}
inline NORETURN bool systemDetectsMemoryTagFaultsTestOnly() {
UNREACHABLE("memory tagging not supported");
diff --git a/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp b/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
index d0d93316f212e..09093e11452dd 100644
--- a/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
@@ -28,6 +28,7 @@ TEST(MemtagBasicDeathTest, Unsupported) {
EXPECT_DEATH(untagPointer((uptr)0), "not supported");
EXPECT_DEATH(extractTag((uptr)0), "not supported");
+ EXPECT_DEATH(systemSupportsMemoryTagging(), "not supported");
EXPECT_DEATH(systemDetectsMemoryTagFaultsTestOnly(), "not supported");
EXPECT_DEATH(enableSystemMemoryTaggingTestOnly(), "not supported");
diff --git a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
index 8741c8299b57c..855a3e6e6109f 100644
--- a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
@@ -27,7 +27,9 @@
const scudo::uptr PageSize = scudo::getPageSizeCached();
template <typename Config> static scudo::Options getOptionsForConfig() {
- if (!scudo::systemSupportsMemoryTagging())
+ if (!Config::getMaySupportMemoryTagging() ||
+ !scudo::archSupportsMemoryTagging() ||
+ !scudo::systemSupportsMemoryTagging())
return {};
scudo::AtomicOptions AO;
AO.set(scudo::OptionBit::UseMemoryTagging);
diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
index 84359251a02aa..c802ed22fbad0 100644
--- a/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_cpp_test.cpp
@@ -187,7 +187,8 @@ TEST_F(ScudoWrappersCppTest, ThreadedNew) {
// TODO: Investigate why libc sometimes crashes with tag missmatch in
// __pthread_clockjoin_ex.
std::unique_ptr<scudo::ScopedDisableMemoryTagChecks> NoTags;
- if (!SCUDO_ANDROID && scudo::systemSupportsMemoryTagging())
+ if (!SCUDO_ANDROID && scudo::archSupportsMemoryTagging() &&
+ scudo::systemSupportsMemoryTagging())
NoTags = std::make_unique<scudo::ScopedDisableMemoryTagChecks>();
Ready = false;
More information about the llvm-commits
mailing list