diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -74,6 +75,14 @@ this->disableMemoryTagging(); } ~TestAllocator() { this->unmapTestOnly(); } + + void *operator new(size_t size) { + void *p = nullptr; + EXPECT_EQ(0, posix_memalign(&p, alignof(TestAllocator), size)); + return p; + } + + void operator delete(void *ptr) { free(ptr); } }; template struct ScudoCombinedTest : public Test { diff --git a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -63,6 +64,14 @@ template struct TestAllocator : public SizeClassAllocator { ~TestAllocator() { this->unmapTestOnly(); } + + void *operator new(size_t size) { + void *p = nullptr; + EXPECT_EQ(0, posix_memalign(&p, alignof(TestAllocator), size)); + return p; + } + + void operator delete(void *ptr) { free(ptr); } }; template struct ScudoPrimaryTest : public Test {};