[compiler-rt] ed7868d - [nfc][sanitizer] Replace mmap with InternalMmapVector in test (#112756)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 11:07:47 PDT 2024
Author: Vitaly Buka
Date: 2024-10-17T11:07:43-07:00
New Revision: ed7868de03c7b93809f87ed1a01103b926564feb
URL: https://github.com/llvm/llvm-project/commit/ed7868de03c7b93809f87ed1a01103b926564feb
DIFF: https://github.com/llvm/llvm-project/commit/ed7868de03c7b93809f87ed1a01103b926564feb.diff
LOG: [nfc][sanitizer] Replace mmap with InternalMmapVector in test (#112756)
Added:
Modified:
compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp
index bed19d15a8ec77..803c8d39362e27 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp
@@ -65,8 +65,8 @@ TEST(SanitizerCommon, PthreadDestructorIterations) {
TEST(SanitizerCommon, IsAccessibleMemoryRange) {
const int page_size = GetPageSize();
- uptr mem = (uptr)mmap(0, 3 * page_size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANON, -1, 0);
+ InternalMmapVector<char> buffer(3 * page_size);
+ uptr mem = reinterpret_cast<uptr>(buffer.data());
// Protect the middle page.
mprotect((void *)(mem + page_size), page_size, PROT_NONE);
EXPECT_TRUE(IsAccessibleMemoryRange(mem, page_size - 1));
@@ -78,8 +78,6 @@ TEST(SanitizerCommon, IsAccessibleMemoryRange) {
EXPECT_TRUE(IsAccessibleMemoryRange(mem + 2 * page_size, page_size));
EXPECT_FALSE(IsAccessibleMemoryRange(mem, 3 * page_size));
EXPECT_FALSE(IsAccessibleMemoryRange(0x0, 2));
-
- munmap((void *)mem, 3 * page_size);
}
} // namespace __sanitizer
More information about the llvm-commits
mailing list