mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 13:35:03 +00:00
Kernel: Crash on memory access in non-readable regions
This patch makes it possible to make memory regions non-readable. This is enforced using the "present" bit in the page tables. A process that hits an not-present page fault in a non-readable region will be crashed.
This commit is contained in:
@@ -306,6 +306,7 @@ int Process::sys$mprotect(void* addr, size_t size, int prot)
|
||||
return -EINVAL;
|
||||
if (!region->is_mmap())
|
||||
return -EPERM;
|
||||
region->set_readable(prot & PROT_READ);
|
||||
region->set_writable(prot & PROT_WRITE);
|
||||
region->remap();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user