[compiler-rt] [nfc][sanitizer] Replace mmap with InternalMmapVector in test (PR #112756)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 11:07:51 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/112756.diff
1 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp (+2-4)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/112756
More information about the llvm-commits
mailing list