HomeFreeBSD

exit1(): Ensure that SIGCHLD from reparented child is queued to reaper

Description

exit1(): Ensure that SIGCHLD from reparented child is queued to reaper

We have a reaper R and child A with grandchild B. Now, suppose that B
already have exited, and that A did not waited on B. When A is exiting,
its child B is reparented to R, but its p_ksi was already queued for A.
This means that SIGCHLD is not queued to R, it is only marked as pending
in bitmap.

If other SIGCHLD is queued, we would miss a delivery of the notification
for B exiting. Additionally, R does not see siginfo for B.

Do not even try to send SIGCHLD if the target is zombie. Only update
the ksi state for possible consumption by the reaper.

Tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D50752

Details

Provenance
kibAuthored on Jun 8 2025, 7:31 AM
Reviewer
markj
Differential Revision
D50752: Fixes for timeout(1)
Parents
rG2be717b45a33: kern_sigsuspend: rename wchan
Branches
Unknown
Tags
Unknown