mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +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:
parent
ddd5411472
commit
f41ae755ec
5 changed files with 41 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue