From 02ef3f6343a82bf16202db82d176fb78d35a69de Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 20 Dec 2020 18:45:08 +0100 Subject: [PATCH] Kernel: Ptrace should not assert on poke in non-mapped tracee memory --- Kernel/Syscalls/ptrace.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/Syscalls/ptrace.cpp b/Kernel/Syscalls/ptrace.cpp index 66b3c46451..ccc585a511 100644 --- a/Kernel/Syscalls/ptrace.cpp +++ b/Kernel/Syscalls/ptrace.cpp @@ -75,7 +75,8 @@ KResult Process::poke_user_data(Userspace address, u32 data) ProcessPagingScope scope(*this); Range range = { VirtualAddress(address), sizeof(u32) }; auto* region = find_region_containing(range); - ASSERT(region != nullptr); + if (!region) + return KResult(-EFAULT); if (region->is_shared()) { // If the region is shared, we change its vmobject to a PrivateInodeVMObject // to prevent the write operation from changing any shared inode data