mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03: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
Notes:
sideshowbarker
2024-07-18 03:48:08 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/bb1ad759c55 Pull-request: https://github.com/SerenityOS/serenity/pull/10070
@ -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 New Issue
Block a user