mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
Kernel: Disallow empty ranges in munmap/mprotect/madvise
This commit is contained in:
parent
bf5b7c32d8
commit
6634da31d9
1 changed files with 9 additions and 0 deletions
|
@ -458,6 +458,9 @@ int Process::sys$munmap(void* addr, size_t size)
|
|||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
|
||||
if (!size)
|
||||
return -EINVAL;
|
||||
|
||||
if (!is_user_range(VirtualAddress(addr), size))
|
||||
return -EFAULT;
|
||||
|
||||
|
@ -499,6 +502,9 @@ int Process::sys$mprotect(void* addr, size_t size, int prot)
|
|||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
|
||||
if (!size)
|
||||
return -EINVAL;
|
||||
|
||||
if (!is_user_range(VirtualAddress(addr), size))
|
||||
return -EFAULT;
|
||||
|
||||
|
@ -566,6 +572,9 @@ int Process::sys$madvise(void* address, size_t size, int advice)
|
|||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
|
||||
if (!size)
|
||||
return -EINVAL;
|
||||
|
||||
if (!is_user_range(VirtualAddress(address), size))
|
||||
return -EFAULT;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue