Skip to content

Commit

Permalink
[nfc][sanitizer] Replace mmap with InternalMmapVector in test (#112756)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka authored Oct 17, 2024
1 parent 2c93598 commit ed7868d
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
Expand Down

0 comments on commit ed7868d

Please sign in to comment.