Skip to content

Commit d0a260b

Browse files
authored
[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.
1 parent 6101248 commit d0a260b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, StackDepot) {
10431043
// which covers only simple operations and ensure the configuration is able to
10441044
// compile.
10451045
TEST(ScudoCombinedTest, BasicTrustyConfig) {
1046-
using AllocatorT = scudo::Allocator<scudo::TrustyConfig>;
1046+
using AllocatorT = TestAllocator<scudo::TrustyConfig>;
10471047
auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
10481048

10491049
for (scudo::uptr ClassId = 1U;
@@ -1107,7 +1107,7 @@ struct TestQuarantineConfig {
11071107

11081108
// Verify that the quarantine exists by default.
11091109
TEST(ScudoCombinedTest, QuarantineEnabled) {
1110-
using AllocatorT = scudo::Allocator<TestQuarantineConfig>;
1110+
using AllocatorT = TestAllocator<TestQuarantineConfig>;
11111111
auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
11121112

11131113
const scudo::uptr Size = 1000U;
@@ -1132,7 +1132,7 @@ struct TestQuarantineDisabledConfig : TestQuarantineConfig {
11321132
};
11331133

11341134
TEST(ScudoCombinedTest, QuarantineDisabled) {
1135-
using AllocatorT = scudo::Allocator<TestQuarantineDisabledConfig>;
1135+
using AllocatorT = TestAllocator<TestQuarantineDisabledConfig>;
11361136
auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
11371137

11381138
const scudo::uptr Size = 1000U;
@@ -1154,7 +1154,7 @@ TEST(ScudoCombinedTest, QuarantineDisabled) {
11541154

11551155
// Verify that no special quarantine blocks appear in iterateOverChunks.
11561156
TEST(ScudoCombinedTest, QuarantineIterateOverChunks) {
1157-
using AllocatorT = scudo::Allocator<TestQuarantineConfig>;
1157+
using AllocatorT = TestAllocator<TestQuarantineConfig>;
11581158
auto Allocator = std::unique_ptr<AllocatorT>(new AllocatorT());
11591159

11601160
// Do a bunch of allocations and deallocations. At the end there should

0 commit comments

Comments
 (0)