mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>, Jann Horn <jannh@google.com>,
	 Andy Lutomirski <luto@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RFC v3 0/4] pidfd: add CLONE_AUTOREAP and CLONE_PIDFD_AUTOKILL
Date: Tue, 17 Feb 2026 23:46:45 +0100	[thread overview]
Message-ID: <20260217-chorgesang-neigt-1b032054aefa@brauner> (raw)
In-Reply-To: <20260217-work-pidfs-autoreap-v3-0-33a403c20111@kernel.org>

> CLONE_PIDFD_AUTOKILL ties a child's lifetime to the pidfd returned from
> clone3(). When the last reference to the struct file created by clone3()
> is closed the kernel sends SIGKILL to the child.

So this is for me one of the most useful features that I've been
pondering for a long time but always put off. It's usefulness is
intimately tied to the fact that the kill-on-close contract cannot be
flaunted no matter what gets executed (freebsd has the same behavior for
pdfork()).

If the parent says to SIGKILL the child once the fd is closed then it
isn't reset no matter if privileged exec or credential change. This is
in contrast to related mechanisms such as pdeath_signal which gets reset
by all kinds of crap but then can be set again and it's just cumbersome
and not super useful. Not even signal delivery is guaranteed as
permission are checked for that as well.

My ideal model for kill-on-close is to just ruthlessly enforce that the
kernel murders anything once the file is released. But I would really
like to get some thoughts on this.

      parent reply	other threads:[~2026-02-17 22:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 22:35 Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 1/4] clone: add CLONE_AUTOREAP Christian Brauner
2026-02-18 11:25   ` Oleg Nesterov
2026-02-18 13:30     ` Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 2/4] pidfd: add CLONE_PIDFD_AUTOKILL Christian Brauner
2026-02-17 23:17   ` Linus Torvalds
2026-02-17 23:38     ` Jann Horn
2026-02-17 23:44       ` Linus Torvalds
2026-02-18  8:18         ` Christian Brauner
2026-02-18 14:00           ` Theodore Tso
2026-02-18 13:29         ` Theodore Tso
2026-02-18 10:21       ` Christian Brauner
2026-02-17 23:43   ` Jann Horn
2026-02-18 10:00     ` Christian Brauner
2026-02-18 11:50   ` Oleg Nesterov
2026-02-18 13:31     ` Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 3/4] selftests/pidfd: add CLONE_AUTOREAP tests Christian Brauner
2026-02-17 22:35 ` [PATCH RFC v3 4/4] selftests/pidfd: add CLONE_PIDFD_AUTOKILL tests Christian Brauner
2026-02-17 22:46 ` Christian Brauner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260217-chorgesang-neigt-1b032054aefa@brauner \
    --to=brauner@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®