[compiler-rt] d0a260b - [scudo] Use TestAllocator wrapper to ensure proper cleanup (#160800)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 23:48:06 PDT 2025


Author: Fabio D'Urso
Date: 2025-09-27T08:48:02+02:00
New Revision: d0a260b1d124dcad62102011aa80df5f868d28f7

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

LOG: [scudo] Use TestAllocator wrapper to ensure proper cleanup (#160800)

Instead of directly instantiating scudo::Allocator, using the test
TestAllocator wrapper class ensures that unmapTestOnly is called at the
end of the test.

This fixes the issue of QuarantineIterateOverChunks failing on Fuchsia
because of a clobbered TLS pointer left by QuarantineEnabled.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index 5b56b973d55f8..5fdfd1e7c55cc 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -1043,7 +1043,7 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepot) {
 // which covers only simple operations and ensure the configuration is able to
 // compile.
 TEST(ScudoCombinedTest, BasicTrustyConfig) {
-  using AllocatorT = scudo::Allocator<scudo::TrustyConfig>;
+  using AllocatorT = TestAllocator<scudo::TrustyConfig>;
   auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
 
   for (scudo::uptr ClassId = 1U;
@@ -1107,7 +1107,7 @@ struct TestQuarantineConfig {
 
 // Verify that the quarantine exists by default.
 TEST(ScudoCombinedTest, QuarantineEnabled) {
-  using AllocatorT = scudo::Allocator<TestQuarantineConfig>;
+  using AllocatorT = TestAllocator<TestQuarantineConfig>;
   auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
 
   const scudo::uptr Size = 1000U;
@@ -1132,7 +1132,7 @@ struct TestQuarantineDisabledConfig : TestQuarantineConfig {
 };
 
 TEST(ScudoCombinedTest, QuarantineDisabled) {
-  using AllocatorT = scudo::Allocator<TestQuarantineDisabledConfig>;
+  using AllocatorT = TestAllocator<TestQuarantineDisabledConfig>;
   auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
 
   const scudo::uptr Size = 1000U;
@@ -1154,7 +1154,7 @@ TEST(ScudoCombinedTest, QuarantineDisabled) {
 
 // Verify that no special quarantine blocks appear in iterateOverChunks.
 TEST(ScudoCombinedTest, QuarantineIterateOverChunks) {
-  using AllocatorT = scudo::Allocator<TestQuarantineConfig>;
+  using AllocatorT = TestAllocator<TestQuarantineConfig>;
   auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
 
   // Do a bunch of allocations and deallocations. At the end there should


        


More information about the llvm-commits mailing list