浏览代码

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.
Andreas Kling 5 年之前
父节点
当前提交
c23addd1fb
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Kernel/Syscall.cpp

+ 4 - 0
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);
 }