mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
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:
parent
2c72d495a3
commit
c713e76941
Notes:
sideshowbarker
2024-07-17 09:47:09 +09:00
Author: https://github.com/awesomekling
Commit: c713e76941
1 changed files with 3 additions and 0 deletions
|
@ -41,6 +41,9 @@ TEST_CASE(test_efault)
|
||||||
int fd = open("/dev/zero", O_RDONLY);
|
int fd = open("/dev/zero", O_RDONLY);
|
||||||
int rc = -1;
|
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)
|
// Test a one-page mapping (4KB)
|
||||||
u8* one_page = (u8*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
|
u8* one_page = (u8*)mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
|
||||||
VERIFY(one_page);
|
VERIFY(one_page);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue