Kernel: Fix syscall interrupt disabling

If thread had a terminating signal, syscall leaving would try to lock
process's mutex while not having interrupts enabled
This commit is contained in:
Bananymous 2025-06-06 11:12:48 +03:00
parent 66726090ec
commit 652eb2346c
1 changed files with 2 additions and 4 deletions

View File

@ -62,14 +62,10 @@ namespace Kernel
ret = sys_fork_trampoline();
else
#pragma GCC diagnostic push
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic warning "-Wmaybe-uninitialized"
#endif
ret = (Process::current().*s_syscall_handlers[syscall])(arg1, arg2, arg3, arg4, arg5);
#pragma GCC diagnostic pop
Processor::set_interrupt_state(InterruptState::Disabled);
#if DUMP_ALL_SYSCALLS
if (ret.is_error())
dprintln("{} pid {}: {}: {}", process_path, Process::current().pid(), s_syscall_names[syscall], ret.error());
@ -100,6 +96,8 @@ namespace Kernel
if (ret.is_error() && ret.error().get_error_code() == EINTR)
ret = BAN::Error::from_errno(ERESTART);
Processor::set_interrupt_state(InterruptState::Disabled);
ASSERT(Kernel::Thread::current().state() == Kernel::Thread::State::Executing);
if (ret.is_error())