[compiler-rt] 913d78c - [scudo] Regression test for the MTE crash in storeEndMarker.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 13:43:34 PST 2021


Author: Evgenii Stepanov
Date: 2021-11-16T13:43:15-08:00
New Revision: 913d78c40c37c9c3428285d868ce454b058e40f3

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

LOG: [scudo] Regression test for the MTE crash in storeEndMarker.

The original problem was fixed in D105261.

Differential Revision: https://reviews.llvm.org/D114022

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 a2461c53cd950..deccccf4f1f6a 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -679,3 +679,23 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, DisableMemInit) {
 
   Allocator->setOption(scudo::Option::ThreadDisableMemInit, 0);
 }
+
+SCUDO_TYPED_TEST(ScudoCombinedTest, ReallocateInPlaceStress) {
+  auto *Allocator = this->Allocator.get();
+
+  // Regression test: make realloc-in-place happen at the very right end of a
+  // mapped region.
+  constexpr int nPtrs = 10000;
+  for (int i = 1; i < 32; ++i) {
+    scudo::uptr Size = 16 * i - 1;
+    std::vector<void *> Ptrs;
+    for (int i = 0; i < nPtrs; ++i) {
+      void *P = Allocator->allocate(Size, Origin);
+      P = Allocator->reallocate(P, Size + 1);
+      Ptrs.push_back(P);
+    }
+
+    for (int i = 0; i < nPtrs; ++i)
+      Allocator->deallocate(Ptrs[i], Origin);
+  }
+}


        


More information about the llvm-commits mailing list