1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

Kernel: Fix behaviour of PT_TRACEME in ptrace

The behaviour of the PT_TRACEME feature has been broken for some time,
this change fixes it.

When this ptrace flag is used, the traced process should be paused
before exiting execve.
We previously were sending the SIGSTOP signal at a stage where
interrupts are disabled, and the traced process continued executing
normally, without pausing and waiting for the tracer.
This change fixes it.
This commit is contained in:
Itamar 2020-08-15 10:57:53 +03:00 committed by Andreas Kling
parent 47d7faa998
commit 3b422564f3
2 changed files with 4 additions and 6 deletions

View file

@ -1190,10 +1190,6 @@ extern "C" void context_first_init(Thread* from_thread, Thread* to_thread, TrapF
Scheduler::enter_current(*from_thread);
if (to_thread->process().wait_for_tracer_at_next_execve()) {
to_thread->send_urgent_signal_to_self(SIGSTOP);
}
// Since we got here and don't have Scheduler::context_switch in the
// call stack (because this is the first time we switched into this
// context), we need to notify the scheduler so that it can release