From 5f3b2cc91fdb9f5f6ab7ecec96257878209a4680 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Fri, 28 Nov 2025 16:05:52 +1100 Subject: [PATCH] fix(procmgr): send SIGCHLD to parent after child exits Signed-off-by: Anhad Singh --- bootstrap/src/procmgr.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bootstrap/src/procmgr.rs b/bootstrap/src/procmgr.rs index 2bec5e1870..f215e854b6 100644 --- a/bootstrap/src/procmgr.rs +++ b/bootstrap/src/procmgr.rs @@ -1712,6 +1712,20 @@ impl<'a> ProcScheme<'a> { drop(proc_guard); if let Some(parent_rc) = self.processes.get(&ppid) { + // When a process exits, the parent is sent SIGCHLD. The process has no threads + // at this point. + if let Err(err) = self.on_send_sig( + current_pid, + KillTarget::Proc(ppid), + SIGCHLD as u8, + &mut false, + KillMode::Idempotent, + true, // is_sigchld_to_parent + awoken, + ) { + log::error!("failed to send SIGCHLD to parent PID {ppid:?}: {err}"); + } + if let Some(init_rc) = self.processes.get(&INIT_PID) { awoken.extend(init_rc.borrow_mut().waitpid_waiting.drain(..));