From 575c7ed41428bf08b7b6419284f45ee29da502ed Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 16 Feb 2021 11:32:00 +0100 Subject: [PATCH] Kernel: Make sys$msyscall() EFAULT on non-user address Fixes #5361. --- Kernel/Syscalls/mmap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 6f6c04e459..8eeee8be33 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -563,6 +563,9 @@ int Process::sys$msyscall(void* address) return 0; } + if (!is_user_address(VirtualAddress { address })) + return -EFAULT; + auto* region = space().find_region_containing(Range { VirtualAddress { address }, 1 }); if (!region) return -EINVAL;