From c23addd1fb0221207526b020ed417ec1ed1f93d9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 18 Nov 2019 12:35:14 +0100 Subject: [PATCH] Kernel: When userspaces calls a removed syscall, fail with ENOSYS This is a bit gentler than jumping to 0x0, which always crashes the whole process. Also log a debug message about what happened, and let the user know that it's probably time to rebuild the program. --- Kernel/Syscall.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 00a8034337..163d469e53 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -86,6 +86,10 @@ int handle(RegisterDump& regs, u32 function, u32 arg1, u32 arg2, u32 arg3) return -ENOSYS; } + if (s_syscall_table[function] == nullptr) { + dbg() << process << ": Null syscall " << function << " requested: \"" << to_string((Function)function) << "\", you probably need to rebuild this program."; + return -ENOSYS; + } return (process.*(s_syscall_table[function]))(arg1, arg2, arg3); }