1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

Kernel: Change wait blocking to Process-only blocking

This prevents zombies created by multi-threaded applications and brings
our model back to closer to what other OSs do.

This also means that SIGSTOP needs to halt all threads, and SIGCONT needs
to resume those threads.
This commit is contained in:
Tom 2020-12-08 21:18:45 -07:00 committed by Andreas Kling
parent 47ede74326
commit c455fc2030
11 changed files with 284 additions and 203 deletions

View file

@ -484,7 +484,8 @@ void debug_handler(TrapFrame* trap)
clac();
auto& regs = *trap->regs;
auto current_thread = Thread::current();
if (&current_thread->process() == nullptr || (regs.cs & 3) == 0) {
auto& process = current_thread->process();
if ((regs.cs & 3) == 0) {
klog() << "Debug Exception in Ring0";
Processor::halt();
return;
@ -494,8 +495,8 @@ void debug_handler(TrapFrame* trap)
if (!is_reason_singlestep)
return;
if (current_thread->tracer()) {
current_thread->tracer()->set_regs(regs);
if (auto tracer = process.tracer()) {
tracer->set_regs(regs);
}
current_thread->send_urgent_signal_to_self(SIGTRAP);
}
@ -506,13 +507,14 @@ void breakpoint_handler(TrapFrame* trap)
clac();
auto& regs = *trap->regs;
auto current_thread = Thread::current();
if (&current_thread->process() == nullptr || (regs.cs & 3) == 0) {
auto& process = current_thread->process();
if ((regs.cs & 3) == 0) {
klog() << "Breakpoint Trap in Ring0";
Processor::halt();
return;
}
if (current_thread->tracer()) {
current_thread->tracer()->set_regs(regs);
if (auto tracer = process.tracer()) {
tracer->set_regs(regs);
}
current_thread->send_urgent_signal_to_self(SIGTRAP);
}