Skip to content

Conversation

@vitalybuka
Copy link
Collaborator

No description provided.

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Oct 17, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

Changes

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 --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

@vitalybuka vitalybuka merged commit ed7868d into main Oct 17, 2024
8 of 9 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcsanitizer-replace-mmap-with-internalmmapvector-in-test branch October 17, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-precommit-approval PR for CI feedback, not intended for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants