Browse Source

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 years ago
parent
commit
c23addd1fb
1 changed files with 4 additions and 0 deletions
  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);
 }