Kernel: Fix kernel panic on signal

Signals are now added/handled without Scheduler's lock
This commit is contained in:
Bananymous 2024-03-18 16:05:47 +02:00
parent e447d5fccf
commit 9607b4205a
2 changed files with 2 additions and 2 deletions

View File

@ -247,7 +247,6 @@ namespace Kernel
void Process::exit(int status, int signal)
{
LockGuard _(m_process_lock);
m_exit_status.exit_code = __WGENEXITCODE(status, signal);
for (auto* thread : m_threads)
if (thread != &Thread::current())
@ -330,6 +329,7 @@ namespace Kernel
BAN::ErrorOr<long> Process::sys_exit(int status)
{
ASSERT(this == &Process::current());
LockGuard _(m_process_lock);
exit(status, 0);
ASSERT_NOT_REACHED();
}

View File

@ -247,9 +247,9 @@ namespace Kernel
m_lock.unlock(InterruptState::Disabled);
start_thread(current->rsp(), current->rip());
case Thread::State::Executing:
m_lock.unlock(InterruptState::Disabled);
while (current->can_add_signal_to_execute())
current->handle_signal();
m_lock.unlock(InterruptState::Disabled);
continue_thread(current->rsp(), current->rip());
case Thread::State::Terminated:
ASSERT_NOT_REACHED();