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.
This commit is contained in:
Brian Gianforcaro 2021-07-18 10:01:47 -07:00 committed by Gunnar Beutner
parent 85e95105c6
commit 354e18a5a0
Notes: sideshowbarker 2024-07-18 08:42:58 +09:00

View File

@ -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());