Bug 250386 - procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum) doesn't work on 12.2-STABLE
Summary: procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum) doesn't work on 12.2-STABLE
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2020-10-16 03:24 UTC by Yuri Victorovich
Modified: 2020-10-16 13:06 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
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.