Kernel: Terminate current thread immediately on unhandled urgent signal

If we're sending an urgent signal (i.e. due to unexpected conditions)
and the Process did not setup any signal handler, we should immediately
terminate the Thread, to ensure the current trap frame is preserved for
the impending core dump.
This commit is contained in:
Idan Horowitz 2021-12-06 19:33:19 +02:00 committed by Andreas Kling
parent 971b3645ef
commit 548488f050
Notes: sideshowbarker 2024-07-17 23:06:24 +09:00

View file

@ -701,6 +701,10 @@ void Thread::send_urgent_signal_to_self(u8 signal)
SpinlockLocker lock(g_scheduler_lock);
result = dispatch_signal(signal);
}
if (result == DispatchSignalResult::Terminate) {
Thread::current()->die_if_needed();
VERIFY_NOT_REACHED(); // dispatch_signal will request termination of the thread, so the above call should never return
}
if (result == DispatchSignalResult::Yield)
yield_and_release_relock_big_lock();
}