Linux Security Modules development
 help / color / mirror / Atom feed
From: Li Chen <me@linux.beauty>
To: "Justin Suess" <utilityemal77@gmail.com>
Cc: "Christian Brauner" <brauner@kernel.org>,
	"Kees Cook" <kees@kernel.org>,
	"Gabriel Krisman Bertazi" <krisman@kernel.org>,
	"Josh Triplett" <josh@joshtriplett.org>,
	"Mateusz Guzik" <mjguzik@gmail.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"John Ericson" <mail@johnericson.me>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <shuah@kernel.org>, "Arnd Bergmann" <arnd@arndb.de>,
	"Oleg Nesterov" <oleg@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Paul Moore" <paul@paul-moore.com>,
	"Eric Paris" <eparis@redhat.com>,
	"\"Mickaël Salaün\"" <mic@digikod.net>,
	"\"Günther Noack\"" <gnoack@google.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Jan Kara" <jack@suse.cz>, linux-api <linux-api@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-kselftest <linux-kselftest@vger.kernel.org>,
	linux-doc <linux-doc@vger.kernel.org>,
	audit <audit@vger.kernel.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>
Subject: Re: [RFC PATCH 00/24] pidfd: add a minimal process spawn builder
Date: Wed, 19 Aug 2026 09:14:41 +0800	[thread overview]
Message-ID: <1a01795b07a.1f456216580426.3401229391386650127@linux.beauty> (raw)
In-Reply-To: <anJE8SfBLtkh6QSa@zenbox>

Hi Justin,

 ---- On Wed, 05 Aug 2026 04:25:25 +0800  Justin Suess <utilityemal77@gmail.com> wrote --- 
 > On Thu, Jul 16, 2026 at 10:31:26PM +0800, Li Chen wrote:
 > > Hi,
 > > 
 > > This RFC follows feedback on my earlier spawn_template RFC [1]. That
 > > proposal made caching the primary interface; this one starts with general
 > > process construction. Christian suggested a pidfd/pidfs exec builder
 > > modeled after fsconfig(), with enough semantics for userspace to implement
 > > posix_spawn() [2], and Kees agreed [3].
 > > 
 > > This RFC is based on linux-next next-20260710 and depends on two pidfs
 > > fixes that I sent separately:
 > > 
 > >   * pidfs: preserve thread pidfds reopened by file handle
 > >     https://lore.kernel.org/all/20260716052726.1032092-1-me@linux.beauty/
 > >   * pidfs: handle FS_IOC32_GETVERSION in compat ioctl
 > >     https://lore.kernel.org/all/20260716052822.1034228-1-me@linux.beauty/
 > > 
 > > The initial implementation is source-based. The executable path can be
 > > provided with the final run request:
 > > 
 > >     struct pidfd_spawn_run_args run = {
 > >         .path = (unsigned long)"/usr/bin/rg",
 > This should probably be an FD for the path.
 > 
 > This way it prevents race conditions over multiple configuration steps.

Thanks, that makes sense. Using an fd avoids the pathname race and pins
the executable we actually want to run.

 > >         .argv = (unsigned long)argv,
 > >         .envp = (unsigned long)envp,
 > >     };
 > > 
 > >     fd = pidfd_open(0, PIDFD_EMPTY);
 > >     pidfd_spawn_run(fd, &run, sizeof(run));
 > > 
 > > Alternatively, the path can be staged before the final run step:
 > > 
 > >     struct pidfd_spawn_run_args run = {
 > >         .argv = (unsigned long)argv,
 > >         .envp = (unsigned long)envp,
 > >     };
 > > 
 > >     fd = pidfd_open(0, PIDFD_EMPTY);
 > >     pidfd_config(fd, PIDFD_CONFIG_SET_STRING,
 > >                  PIDFD_CONFIG_KEY_PATH, "/usr/bin/rg", 0);
 > Same here. Should probably be an FD to the binary instead.
 > 
 > >     pidfd_spawn_run(fd, &run, sizeof(run));
 > I'm worried this pidfd_spawn_run just adds another varient to the existing
 > myriad of exec* syscalls we already have. Would it be better to just have this
 > work through execveat(fd, "", argv, envp, AT_EMPTY_PATH) instead?
 > 
 > (i.e have execveat take a pidfd directly).
 > 
 > Then you can get rid of pidfd_spawn_run which looks almost structurally
 > identical to execveat (with the argv and envp collapsed).

Thanks, but I'm less sure about using execveat() as the run operation, since it
normally replaces the caller while the builder creates a new child and
returns. A separate run operation still seems clearer to me.

Regards,
Li​



  reply	other threads:[~2026-08-19  1:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 14:31 [RFC PATCH 00/24] pidfd: add a minimal process spawn builder Li Chen
2026-07-16 14:31 ` [RFC PATCH 01/24] pidfd: add spawn builder uapi Li Chen
2026-07-16 14:31 ` [RFC PATCH 02/24] libfs: allow custom validation of stashed inode data Li Chen
2026-07-16 14:31 ` [RFC PATCH 03/24] pidfs: add taskless future pidfd inodes Li Chen
2026-07-16 14:31 ` [RFC PATCH 04/24] pidfd: create taskless spawn builders Li Chen
2026-07-16 14:31 ` [RFC PATCH 05/24] pidfd: add spawn builder path configuration Li Chen
2026-07-16 14:31 ` [RFC PATCH 06/24] exec: expose execveat internals to process builders Li Chen
2026-07-16 14:31 ` [RFC PATCH 07/24] fork: expose vfork completion helper Li Chen
2026-07-16 14:31 ` [RFC PATCH 08/24] pidfs: attach pids to future pidfd files Li Chen
2026-07-16 14:31 ` [RFC PATCH 09/24] fork: let process builders supply preallocated pids Li Chen
2026-07-16 14:31 ` [RFC PATCH 10/24] pidfs: publish future pidfd files Li Chen
2026-07-16 14:31 ` [RFC PATCH 11/24] pidfd: add spawn builder state tracking Li Chen
2026-07-16 14:31 ` [RFC PATCH 12/24] fork: let kernel callers create embryonic tasks Li Chen
2026-07-16 15:57   ` Andy Lutomirski
2026-08-19 10:19     ` Li Chen
2026-07-16 14:31 ` [RFC PATCH 13/24] fork: let new tasks start with task work Li Chen
2026-07-16 14:31 ` [RFC PATCH 14/24] pidfd: create and execute spawn builder tasks Li Chen
2026-07-16 14:31 ` [RFC PATCH 15/24] fork: keep embryonic tasks hidden until exec completes Li Chen
2026-07-16 14:31 ` [RFC PATCH 16/24] audit: add pidfd spawn child contexts Li Chen
2026-07-16 14:31 ` [RFC PATCH 17/24] pidfd: audit child spawn execution Li Chen
2026-07-16 14:31 ` [RFC PATCH 18/24] pidfd: make spawn builder execution signal-safe Li Chen
2026-07-16 14:31 ` [RFC PATCH 19/24] file: expose spawn file-action helpers Li Chen
2026-07-16 14:31 ` [RFC PATCH 20/24] pidfd: add initial spawn file actions Li Chen
2026-07-16 14:31 ` [RFC PATCH 21/24] pidfd: consume spawn builders on the first run attempt Li Chen
2026-07-16 14:31 ` [RFC PATCH 22/24] pidfd: expose spawn builder system calls Li Chen
2026-07-16 14:31 ` [RFC PATCH 23/24] selftests/pidfd: cover pidfd spawn builders Li Chen
2026-07-16 14:31 ` [RFC PATCH 24/24] Documentation: describe " Li Chen
2026-08-04 20:25 ` [RFC PATCH 00/24] pidfd: add a minimal process spawn builder Justin Suess
2026-08-19  1:14   ` Li Chen [this message]
2026-08-25 21:27     ` Mateusz Guzik

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=1a01795b07a.1f456216580426.3401229391386650127@linux.beauty \
    --to=me@linux.beauty \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=audit@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=eparis@redhat.com \
    --cc=gnoack@google.com \
    --cc=jack@suse.cz \
    --cc=josh@joshtriplett.org \
    --cc=kees@kernel.org \
    --cc=krisman@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mail@johnericson.me \
    --cc=mic@digikod.net \
    --cc=mjguzik@gmail.com \
    --cc=oleg@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=shuah@kernel.org \
    --cc=utilityemal77@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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