Kernel: mmap() with both MAP_PRIVATE and MAP_SHARED is an error

This commit is contained in:
Andreas Kling 2019-10-01 19:31:55 +02:00
parent c58d1868cb
commit 3d4ed7f38d
Notes: sideshowbarker 2024-07-19 11:51:57 +09:00

View File

@ -206,6 +206,8 @@ void* Process::sys$mmap(const Syscall::SC_mmap_params* params)
return (void*)-EINVAL;
if ((u32)addr & ~PAGE_MASK)
return (void*)-EINVAL;
if ((flags & MAP_SHARED) && (flags & MAP_PRIVATE))
return (void*)-EINVAL;
if (flags & MAP_ANONYMOUS) {
auto* region = allocate_region(VirtualAddress((u32)addr), size, name ? name : "mmap", prot, false);
if (!region)