From: Jeff Layton <jlayton@kernel.org>
To: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Cc: Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
"Seth Forshee (DigitalOcean)" <sforshee@kernel.org>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] vfs: add FS_USERNS_DELEGATABLE flag and set it for NFS
Date: Tue, 03 Feb 2026 11:21:25 -0500 [thread overview]
Message-ID: <6dd181bf9f6371339a6c31f58f582a9aac3bc36a.camel@kernel.org> (raw)
In-Reply-To: <CAJqdLrphO1GnAZ2=n8wQAP7B+ZwFnD0wSLY7sAjacZTpLZrqBg@mail.gmail.com>
On Tue, 2026-02-03 at 17:11 +0100, Alexander Mikhalitsyn wrote:
> Am Do., 29. Jan. 2026 um 22:48 Uhr schrieb Jeff Layton <jlayton@kernel.org>:
> >
> > Commit e1c5ae59c0f2 ("fs: don't allow non-init s_user_ns for filesystems
> > without FS_USERNS_MOUNT") prevents the mount of any filesystem inside a
> > container that doesn't have FS_USERNS_MOUNT set.
> >
>
> Hi Jeff,
>
> > This broke NFS mounts in our containerized environment. We have a daemon
> > somewhat like systemd-mountfsd running in the init_ns. A process does a
> > fsopen() inside the container and passes it to the daemon via unix
> > socket.
> >
> > The daemon then vets that the request is for an allowed NFS server and
> > performs the mount. This now fails because the fc->user_ns is set to the
> > value in the container and NFS doesn't set FS_USERNS_MOUNT. We don't
> > want to add FS_USERNS_MOUNT to NFS since that would allow the container
> > to mount any NFS server (even malicious ones).
> >
> > Add a new FS_USERNS_DELEGATABLE flag, and enable it on NFS.
>
> Great idea, very similar to what we have with BPFFS/BPF Tokens.
>
> Taking into account this patch, shouldn't we drop FS_USERNS_MOUNT and
> replace it with
> FS_USERNS_DELEGATABLE for bpffs too?
>
> I mean something like:
>
> ======================
> $ git diff
> diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
> index 9f866a010dad..d8dfdc846bd0 100644
> --- a/kernel/bpf/inode.c
> +++ b/kernel/bpf/inode.c
> @@ -1009,10 +1009,6 @@ static int bpf_fill_super(struct super_block
> *sb, struct fs_context *fc)
> struct inode *inode;
> int ret;
>
> - /* Mounting an instance of BPF FS requires privileges */
> - if (fc->user_ns != &init_user_ns && !capable(CAP_SYS_ADMIN))
> - return -EPERM;
> -
> ret = simple_fill_super(sb, BPF_FS_MAGIC, bpf_rfiles);
> if (ret)
> return ret;
> @@ -1085,7 +1081,7 @@ static struct file_system_type bpf_fs_type = {
> .init_fs_context = bpf_init_fs_context,
> .parameters = bpf_fs_parameters,
> .kill_sb = bpf_kill_super,
> - .fs_flags = FS_USERNS_MOUNT,
> + .fs_flags = FS_USERNS_DELEGATABLE,
> };
>
> static int __init bpf_init(void)
> ======================
>
> Because it feels like we were basically implementing this FS_USERNS_DELEGATABLE
> flag implicitly for BPFFS before. I can submit a patch for BPFFS later
> after testing.
>
Yeah, looks like a good thing to change, since it should have the same
effect. Assuming that works the way it should:
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-02-03 16:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 21:47 Jeff Layton
2026-02-03 15:08 ` Christian Brauner
2026-02-03 15:41 ` Anna Schumaker
2026-06-09 10:57 ` Jeff Layton
2026-02-03 16:11 ` Alexander Mikhalitsyn
2026-02-03 16:21 ` Jeff Layton [this message]
2026-02-03 16:41 ` Christian Brauner
2026-02-03 16:45 ` Alexander Mikhalitsyn
2026-06-08 20:08 ` Jeff Layton
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=6dd181bf9f6371339a6c31f58f582a9aac3bc36a.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=alexander@mihalicyn.com \
--cc=anna@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=sforshee@kernel.org \
--cc=trondmy@kernel.org \
--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
Powered by JetHome