summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-01 19:31:55 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-01 19:31:55 +0200
commit3d4ed7f38def0b018c2a9c02da0e331e46f01f43 (patch)
tree4b3a8ff950db31f6ae11f3ab55af99f36a614bb8 /Kernel
parentc58d1868cbe9b9b2d17026f66ed7ee9c3fe90450 (diff)
downloadserenity-3d4ed7f38def0b018c2a9c02da0e331e46f01f43.zip
Kernel: mmap() with both MAP_PRIVATE and MAP_SHARED is an error
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index c72388c962..4441433750 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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)