1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:18:12 +00:00

Kernel: Fix crash when delivering signal to barely created thread

We need to wait until a thread is fully set up and ready for running
before attempting to deliver a signal. Otherwise we may not have a
user stack yet.

Also, remove the Skip0SchedulerPasses and Skip1SchedulerPass thread
states that we don't really need anymore with software context switching.

Fixes the kernel crash reported in #3419
This commit is contained in:
Tom 2020-09-07 08:31:00 -06:00 committed by Andreas Kling
parent f1a65d1d70
commit c3d231616c
5 changed files with 32 additions and 21 deletions

View file

@ -94,7 +94,8 @@ pid_t Process::sys$fork(RegisterState& regs)
g_processes->prepend(child);
}
child_first_thread->set_state(Thread::State::Skip1SchedulerPass);
child_first_thread->set_affinity(Thread::current()->affinity());
child_first_thread->set_state(Thread::State::Runnable);
return child->pid().value();
}