mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-05 07:29:49 +00:00
Kernel: Allow calling sys$waitid on traced, non-child processes
Previously, attempting to call sys$waitid on non-child processes returned ECHILD. That prevented debugging non-child processes by attaching to them during runtime (as opposed to forking and debugging the child, which is what was previously supported). We now allow calling sys$waitid on a any process that is being traced by us, even if it's not our child.
This commit is contained in:
parent
6b4777c558
commit
bb1ad759c5
|
@ -32,9 +32,12 @@ KResultOr<FlatPtr> Process::sys$waitid(Userspace<const Syscall::SC_waitid_params
|
|||
break;
|
||||
case P_PID: {
|
||||
auto waitee_process = Process::from_pid(params.id);
|
||||
if (!waitee_process || waitee_process->ppid() != Process::current().pid()) {
|
||||
if (!waitee_process)
|
||||
return ECHILD;
|
||||
bool waitee_is_child = waitee_process->ppid() == Process::current().pid();
|
||||
bool waitee_is_our_tracee = waitee_process->has_tracee_thread(Process::current().pid());
|
||||
if (!waitee_is_child && !waitee_is_our_tracee)
|
||||
return ECHILD;
|
||||
}
|
||||
waitee = waitee_process.release_nonnull();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue