Skip to content

Commit 913d78c

Browse files
committed
[scudo] Regression test for the MTE crash in storeEndMarker.
The original problem was fixed in D105261. Differential Revision: https://reviews.llvm.org/D114022
1 parent 7c3d19a commit 913d78c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,3 +679,23 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, DisableMemInit) {
679679

680680
Allocator->setOption(scudo::Option::ThreadDisableMemInit, 0);
681681
}
682+
683+
SCUDO_TYPED_TEST(ScudoCombinedTest, ReallocateInPlaceStress) {
684+
auto *Allocator = this->Allocator.get();
685+
686+
// Regression test: make realloc-in-place happen at the very right end of a
687+
// mapped region.
688+
constexpr int nPtrs = 10000;
689+
for (int i = 1; i < 32; ++i) {
690+
scudo::uptr Size = 16 * i - 1;
691+
std::vector<void *> Ptrs;
692+
for (int i = 0; i < nPtrs; ++i) {
693+
void *P = Allocator->allocate(Size, Origin);
694+
P = Allocator->reallocate(P, Size + 1);
695+
Ptrs.push_back(P);
696+
}
697+
698+
for (int i = 0; i < nPtrs; ++i)
699+
Allocator->deallocate(Ptrs[i], Origin);
700+
}
701+
}

0 commit comments

Comments
 (0)