From 8924b1f532a618559f4abd6b9c313cc7652e7aad Mon Sep 17 00:00:00 2001 From: Eric Seifert Date: Wed, 22 Sep 2021 17:56:12 -0700 Subject: [PATCH] Kernel: Allow PROT_NONE in mmap and mprotect for stack regions To allow for userspace guard pages (ruby uses this). Redundant since serenity creates them automatically, but should be allowed anyway. --- Kernel/Syscalls/mmap.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index ace935c8b8..f1699cc2b2 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -80,12 +80,8 @@ static bool validate_mmap_prot(int prot, bool map_stack, bool map_anonymous, Mem if (make_writable && make_executable) return false; - if (map_stack) { - if (make_executable) - return false; - if (!make_readable || !make_writable) - return false; - } + if (map_stack && make_executable) + return false; if (region) { if (make_writable && region->has_been_executable())