Bug 250386

Summary: procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum) doesn't work on 12.2-STABLE
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: kib
Priority: ---    
Version: 12.1-STABLE   
Hardware: Any   
OS: Any   

Description Yuri Victorovich freebsd_committer 2020-10-16 03:24:49 UTC
In the child process I have these lines:

> int signum = SIGKILL;
> if (::procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum) == -1)
>     exit(1);

Parent launches this process, it loops, and then the parent exits.

The child process stays despite the above lines.

I expect it to receive SIGKILL and die once the parent exists, as per procctl(2):
>      PROC_PDEATHSIG_CTL   Request the delivery of a signal when the parent of
>                           the calling process exits.  idtype must be P_PID and
>                           id must be the either caller's pid or zero, with no
>                           difference in effect.  The value is cleared for
>                           child processes and when executing set-user-ID or
>                           set-group-ID binaries.  arg must point to a value of
>                           type int indicating the signal that should be
>                           delivered to the caller.  Use zero to cancel a
>                           previously requested signal delivery.
Comment 1 Konstantin Belousov freebsd_committer 2020-10-16 13:06:05 UTC
Provide minimal but complete reproducer for the issue.