[MINOR] send_signal_to_group assumes PGID equals PID #30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
send_signal_to_group(pid)sends to-pid, assuming the process group ID equals the PID. This is true ifsetpgid(0, 0)succeeded inpre_exec, but:setpgidfails (e.g., process is already a process group leader from a parent), the signal goes to the wrong groupsetpgid, the child might be in the original PGIDImpact
Signals may be sent to the wrong process group, leaving child processes orphaned or killing unrelated processes.
Files
crates/my_init_server/src/process.rs--send_signal_to_grouppre_execclosure --setpgidcallSuggested Fix
setpgidsuccess and handle failuresConfirmed by code inspection at process.rs:509-511. signal::kill(Pid::from_raw(-(pid as i32)), sig) assumes the process group leader PID equals the PGID.