From 6876b9a51497956de86a29ccc5f108b1d37e4327 Mon Sep 17 00:00:00 2001 From: Sahan Fernando Date: Fri, 29 Jan 2021 10:28:27 +1100 Subject: [PATCH] Kernel: Prevent mmap-ing as both fixed and randomized --- Kernel/Syscalls/mmap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 49c14ddba9..47c2ad65ca 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -128,6 +128,9 @@ void* Process::sys$mmap(Userspace user_params) if (!map_shared && !map_private) return (void*)-EINVAL; + if (map_fixed && map_randomized) + return (void*)-EINVAL; + if (!validate_mmap_prot(prot, map_stack)) return (void*)-EINVAL;