mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
Kernel: Add "map_fixed" pledge promise
This is a new promise that guards access to mmap() with MAP_FIXED. Fixed-address mappings are rarely used, but can be useful if you are trying to groom the process address space for malicious purposes. None of our programs need this at the moment, as the only user of MAP_FIXED is DynamicLoader, but the fixed mappings are constructed before the process has had a chance to pledge anything.
This commit is contained in:
parent
a0cbb9068b
commit
84b2d4c475
3 changed files with 6 additions and 0 deletions
|
@ -157,6 +157,10 @@ void* Process::sys$mmap(Userspace<const Syscall::SC_mmap_params*> user_params)
|
|||
REQUIRE_PROMISE(prot_exec);
|
||||
}
|
||||
|
||||
if (prot & MAP_FIXED) {
|
||||
REQUIRE_PROMISE(map_fixed);
|
||||
}
|
||||
|
||||
if (alignment & ~PAGE_MASK)
|
||||
return (void*)-EINVAL;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue