kernel: bad ordering of list insert / wakeup caused crashes

This commit is contained in:
K. Lange 2021-11-24 17:34:06 +09:00
parent ade7d13707
commit 5b16cd6ce4

View File

@ -222,6 +222,7 @@ int send_signal(pid_t process, int signal, int force_root) {
sig->handler = (uintptr_t)receiver->signals[signal];
sig->signum = signal;
memset(&sig->registers_before, 0x00, sizeof(struct regs));
list_insert(receiver->signal_queue, sig);
process_awaken_signal(receiver);
@ -229,8 +230,6 @@ int send_signal(pid_t process, int signal, int force_root) {
make_process_ready(receiver);
}
list_insert(receiver->signal_queue, sig);
if (receiver == this_core->current_process) {
/* Forces us to be rescheduled and enter signal handler */
if (receiver->signal_kstack) {