Tests/Kernel: Make sure inaccessible area in TestEFault is actually that

We were relying on luck to make the mapping before our first mmap() be
inaccessible. Let's make it explicit.
This commit is contained in:
Andreas Kling 2022-08-24 18:33:15 +02:00
parent 2c72d495a3
commit c713e76941
Notes: sideshowbarker 2024-07-17 09:47:09 +09:00

View file

@ -41,6 +41,9 @@ TEST_CASE(test_efault)
int fd = open("/dev/zero", O_RDONLY);
int rc = -1;
// Make an inaccessible hole before the next mapping.
(void)mmap(nullptr, 4096, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
// Test a one-page mapping (4KB)
u8* one_page = (u8*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
VERIFY(one_page);