mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
Kernel+Userland: Refine preventing syscall annotations of Regions option
Instead of using a special case of the annotate_mapping syscall, let's introduce a new prctl option to disallow further annotations of Regions as new syscall Region(s).
This commit is contained in:
parent
08de5abc6d
commit
b27f88f61d
4 changed files with 23 additions and 6 deletions
|
@ -578,6 +578,9 @@ ErrorOr<FlatPtr> Process::sys$annotate_mapping(Userspace<void*> address, int fla
|
|||
if (flags == to_underlying(VirtualMemoryRangeFlags::None))
|
||||
return EINVAL;
|
||||
|
||||
if (!address)
|
||||
return EINVAL;
|
||||
|
||||
if (!Memory::is_user_address(address.vaddr()))
|
||||
return EFAULT;
|
||||
|
||||
|
@ -585,11 +588,6 @@ ErrorOr<FlatPtr> Process::sys$annotate_mapping(Userspace<void*> address, int fla
|
|||
if (space->enforces_syscall_regions() && (flags & to_underlying(VirtualMemoryRangeFlags::SyscallCode)))
|
||||
return EPERM;
|
||||
|
||||
if (!address) {
|
||||
space->set_enforces_syscall_regions(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto* region = space->find_region_containing(Memory::VirtualRange { address.vaddr(), 1 });
|
||||
if (!region)
|
||||
return EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue