diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-09-10 20:00:53 -0700 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-09-11 04:15:16 +0000 |
commit | a4efaa7b47d098421879fa5fcfb2c3610875a579 (patch) | |
tree | ad49bde922ff5ef2894997ce1cb8473b9d06d82c /Tests | |
parent | 890c647e0f21023a05628d604afcaa8a3713f2aa (diff) | |
download | serenity-a4efaa7b47d098421879fa5fcfb2c3610875a579.zip |
Tests/Kernel: Fix test after off-by-one fix in Memory::is_user_range()
Commit 890c647e0f fixed an off-by-one bug, so the mapping of the page
at the very end of the user address space now works correctly.
This change adjusts the test so cover the corner cases the original
version was designed too.validate.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Kernel/TestEFault.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Tests/Kernel/TestEFault.cpp b/Tests/Kernel/TestEFault.cpp index 9fd911f906..07bc4d9777 100644 --- a/Tests/Kernel/TestEFault.cpp +++ b/Tests/Kernel/TestEFault.cpp @@ -85,15 +85,10 @@ TEST_CASE(test_efault) // Test the page just below where the user VM ends. jerk_page = (u8*)mmap((void*)(user_range_ceiling - PAGE_SIZE), PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, 0, 0); - EXPECT_EQ(jerk_page, MAP_FAILED); - EXPECT_EQ(errno, EFAULT); + EXPECT_EQ(jerk_page, (u8*)(user_range_ceiling - PAGE_SIZE)); - // Test the page just before that - jerk_page = (u8*)mmap((void*)(user_range_ceiling - (2 * PAGE_SIZE)), PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); - EXPECT_EQ(jerk_page, (u8*)(user_range_ceiling - (2 * PAGE_SIZE))); - - EXPECT_OK(read, jerk_page, 4096); - EXPECT_EFAULT(read, jerk_page, 4097); + EXPECT_OK(read, jerk_page, PAGE_SIZE); + EXPECT_EFAULT(read, jerk_page, PAGE_SIZE + 1); // Test something that would wrap around the 2^32 mark. EXPECT_EFAULT(read, jerk_page, 0x50000000); |