Re: [RESEND PATCH v2 1/1] prctl: add PR_{GET,SET}_KILL_DESCENDANTS_ON_EXIT
From: Andrew Morton
Date: Mon Jan 28 2019 - 20:23:32 EST
On Fri, 18 Jan 2019 14:11:30 +0100 Jürg Billeter <j@xxxxxxxxx> wrote:
> This introduces a new thread group flag that can be set by calling
>
> prctl(PR_SET_KILL_DESCENDANTS_ON_EXIT, 1, 0, 0, 0)
>
> When a thread group exits with this flag set, it will send SIGKILL to
> all descendant processes. This can be used to prevent stray child
> processes.
>
> This flag is cleared on privilege gaining execve(2) to ensure an
> unprivileged process cannot get a privileged process to send SIGKILL.
>
> Descendants that are orphaned and reparented to an ancestor of the
> current process before the current process exits, will not be killed.
> PR_SET_CHILD_SUBREAPER can be used to contain orphaned processes.
>
> If a descendant gained privileges, the current process may not be
> allowed to kill it, and the descendant process will survive.
> PR_SET_NO_NEW_PRIVS can be used to prevent descendant processes from
> gaining privileges.
I don't feel that I'm able to judge the usefulness of this. It would
help to have a lot more words right here in this changelog which
communicate the value of this change to our users. References are
useful, but please don't send people off to chase down mailing list and
bugzilla discussions as a substitute for properly describing the feature
and its justification.
Some test code in tools/testing/selftests/ would be helpful.
We'll need to update the prctl(2) manpage if we proceed with this.