diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h --- a/compiler-rt/lib/scudo/standalone/combined.h +++ b/compiler-rt/lib/scudo/standalone/combined.h @@ -215,6 +215,7 @@ void unmapTestOnly() { TSDRegistry.unmapTestOnly(); Primary.unmapTestOnly(); + Secondary.unmapTestOnly(); #ifdef GWP_ASAN_HOOKS if (getFlags()->GWP_ASAN_InstallSignalHandlers) gwp_asan::segv_handler::uninstallSignalHandlers(); diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h --- a/compiler-rt/lib/scudo/standalone/secondary.h +++ b/compiler-rt/lib/scudo/standalone/secondary.h @@ -78,6 +78,7 @@ void enable() {} void releaseToOS() {} void disableMemoryTagging() {} + void unmapTestOnly() {} bool setOption(Option O, UNUSED sptr Value) { if (O == Option::ReleaseInterval || O == Option::MaxCacheEntriesCount || O == Option::MaxCacheEntrySize) @@ -321,6 +322,8 @@ void enable() { Mutex.unlock(); } + void unmapTestOnly() { empty(); } + private: void empty() { struct { @@ -451,6 +454,8 @@ void disableMemoryTagging() { Cache.disableMemoryTagging(); } + void unmapTestOnly() { Cache.unmapTestOnly(); } + private: typename Config::SecondaryCache Cache; diff --git a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp @@ -62,6 +62,7 @@ scudo::ScopedString Str(1024); L->getStats(&Str); Str.output(); + L->unmapTestOnly(); } struct NoCacheConfig { @@ -119,6 +120,7 @@ scudo::ScopedString Str(1024); L->getStats(&Str); Str.output(); + L->unmapTestOnly(); } TEST(ScudoSecondaryTest, SecondaryIterate) { @@ -142,6 +144,7 @@ scudo::ScopedString Str(1024); L->getStats(&Str); Str.output(); + L->unmapTestOnly(); } TEST(ScudoSecondaryTest, SecondaryOptions) { @@ -165,6 +168,7 @@ EXPECT_TRUE(L->setOption(scudo::Option::MaxCacheEntrySize, 1UL << 20)); EXPECT_TRUE(L->canCache(1UL << 16)); } + L->unmapTestOnly(); } static std::mutex Mutex; @@ -211,4 +215,5 @@ scudo::ScopedString Str(1024); L->getStats(&Str); Str.output(); + L->unmapTestOnly(); }