From 354e18a5a0267d956de775c7493b28469e3c11c0 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 18 Jul 2021 10:01:47 -0700 Subject: [PATCH] Kernel: Move validate_syscall_preconditions outside of the big lock Now that we hold the space lock for the duration of the validation it should be safe to move the validation outside the big lock. --- Kernel/Syscall.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 38a6fa77f7..611f338749 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -196,9 +196,6 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap) PANIC("Syscall from process with IOPL != 0"); } - // NOTE: We take the big process lock before inspecting memory regions. - process.big_lock().lock(); - MM.validate_syscall_preconditions(process.space(), regs); FlatPtr function; @@ -207,6 +204,9 @@ NEVER_INLINE void syscall_handler(TrapFrame* trap) FlatPtr arg3; regs.capture_syscall_params(function, arg1, arg2, arg3); + process.big_lock().lock(); + + auto result = Syscall::handle(regs, function, arg1, arg2, arg3); if (result.is_error()) { regs.set_return_reg(result.error());