mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
Kernel: Only allow tracing stopped threads
Previously, this allowed tracing Runnable threads (or threads in any other state other than Running). Allowing threads to be traced while they are runnable doesn't seem like a good idea, especially since they can be scheduled while the tracer thread is still in the ptrace() syscall. Other Unixes seem to only allow tracing stopped threads as well.
This commit is contained in:
1 parent
f66d9f8c9c
commit
0b7dc6869e
1 file changed
+1
-1
@@ -68,7 +68,7 @@ static ErrorOr<FlatPtr> handle_ptrace(Kernel::Syscall::SC_ptrace_params const& p
|
||||
if (tracer->tracer_pid() != caller.pid())
|
||||
return EBUSY;
|
||||
|
||||
if (peer->state() == Thread::State::Running)
|
||||
if (peer->state() != Thread::State::Stopped)
|
||||
return EBUSY;
|
||||
|
||||
scheduler_lock.unlock();
|
||||
|
||||
Reference in new issue
Block a user