From f1038b475a33a48cefef8566ee43d8a84aaf91d5 Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Fri, 26 Sep 2025 02:07:48 +0000 Subject: [PATCH] [scudo] Use TestAllocator wrapper to ensure proper cleanup 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. --- compiler-rt/lib/scudo/standalone/tests/combined_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; + using AllocatorT = TestAllocator; auto Allocator = std::unique_ptr(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; + using AllocatorT = TestAllocator; auto Allocator = std::unique_ptr(new AllocatorT()); const scudo::uptr Size = 1000U; @@ -1132,7 +1132,7 @@ struct TestQuarantineDisabledConfig : TestQuarantineConfig { }; TEST(ScudoCombinedTest, QuarantineDisabled) { - using AllocatorT = scudo::Allocator; + using AllocatorT = TestAllocator; auto Allocator = std::unique_ptr(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; + using AllocatorT = TestAllocator; auto Allocator = std::unique_ptr(new AllocatorT()); // Do a bunch of allocations and deallocations. At the end there should