Skip to content

Add prctl to kill descendants on exit

Jürg Billeter linux-api lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/21 patch 1 replyIn review
  2. v2 posting 1/21 patch 6 repliesSuperseded
  3. v11 patch 6 repliesSuperseded

Changes in v2 from the cover letter

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1prctl: add PR_{GET,SET}_KILL_DESCENDANTS_ON_EXITfs/exec.c include/linux/sched/signal.h include/uapi/linux/prctl.h +4 more+40 -01 reply

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchOleg Nesterov
1/1R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RESEND PATCH v2 0/1] Add prctl to kill descendants on exit

This patch adds a new prctl to kill all descendant processes on exit. See commit message for details of the prctl.

This is a replacement of PR_SET_PDEATHSIG_PROC I proposed last year [1]. In the following discussion, Oleg suggested this approach.

The motivation for this is to provide a lightweight mechanism to prevent stray processes. There is also a related Bugzilla entry [2].

PID namespaces can also be used to prevent stray processes, of course. However, they are not quite as lightweight as they typically also require a new mount namespace to be able to mount a new /proc. And they require CAP_SYS_ADMIN. User namespaces can help to gain CAP_SYS_ADMIN, however, that further increases the overhead and the other effects of the user namespace may not be desired.

PID 1 in PID namespaces also exhibits non-standard signal behavior (SIGNAL_UNKILLABLE) [3].

Changes in v2:
- Use bool instead of bitfield to avoid race with PR_SET_CHILD_SUBREAPER

[1] https://lkml.kernel.org/lkml/[email protected]/
[2] https://bugzilla.kernel.org/show_bug.cgi?id=43300
[3] https://lkml.kernel.org/lkml/[email protected]/

Jürg Billeter (1):
prctl: add PR_{GET,SET}_KILL_DESCENDANTS_ON_EXIT

 fs/exec.c                    |  6 ++++++
 include/linux/sched/signal.h |  3 +++
 include/uapi/linux/prctl.h   |  4 ++++
 kernel/exit.c                | 12 ++++++++++++
 kernel/sys.c                 | 11 +++++++++++
 security/apparmor/lsm.c      |  1 +
 security/selinux/hooks.c     |  3 +++
 7 files changed, 40 insertions(+)
Signature · 1 line
2.20.1