From: Greg KH <gregkh@linuxfoundation.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
"Darrick J. Wong" <djwong@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Jeff Layton <jlayton@kernel.org>,
Erin Shepherd <erin.shepherd@e43.eu>,
Chuck Lever <chuck.lever@oracle.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nfs@vger.kernel.org, stable <stable@kernel.org>,
Jens Axboe <axboe@kernel.dk>, Shaohua Li <shli@fb.com>
Subject: Re: [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting file handles
Date: Mon, 9 Dec 2024 10:16:36 +0100 [thread overview]
Message-ID: <2024120942-skincare-flanking-ab83@gregkh> (raw)
In-Reply-To: <CAOQ4uxiEnEC87pVBhfNcjduHOZWfbEoB8HKVbjNHtkaWA5d-JA@mail.gmail.com>
On Mon, Dec 09, 2024 at 09:58:58AM +0100, Amir Goldstein wrote:
> On Mon, Dec 9, 2024 at 8:49 AM Christoph Hellwig <hch@infradead.org> wrote:
> >
> > On Sat, Dec 07, 2024 at 09:49:02AM +0100, Amir Goldstein wrote:
> > > > /* file handles can be used by a process on another node */
> > > > #define EXPORT_OP_ALLOW_REMOTE_NODES (...)
> > >
> > > This has a sound of security which is incorrect IMO.
> > > The fact that we block nfsd export of cgroups does not prevent
> > > any type of userland file server from exporting cgroup file handles.
> >
> > So what is the purpose of the flag? Asking for a coherent name and
> > description was the other bigger ask for me.
> >
> > > Maybe opt-out of nfsd export is a little less safer than opt-in, but
> > > 1. opt-out is and will remain the rare exception for export_operations
> > > 2. at least the flag name EXPORT_OP_LOCAL_FILE_HANDLE
> > > is pretty clear IMO
> >
> > Even after this thread I have absolutely no idea what problem it tries
> > to solve. Maybe that's not just the flag names fault, and not of opt-in
> > vs out, but both certainly don't help.
> >
> > > Plus, as I wrote in another email, the fact that pidfs is SB_NOUSER,
> > > so userspace is not allowed to mount it into the namespace and
> > > userland file servers cannot export the filesystem itself.
> > > That property itself (SB_NOUSER), is therefore a good enough indication
> > > to deny nfsd export of this fs.
> >
> > So check SB_NOUSER in nfsd and be done with it?
> >
>
> That will work for the new user (pidfs).
>
> I think SB_KERNMOUNT qualifies as well, because it signifies
> a mount that does not belong to any user's mount namespace.
>
> For example, tmpfs (shmem) can be exported via nfs, but trying to
> export an anonymous memfd should fail.
>
> To be clear, exporting pidfs or internal shmem via an anonymous fd is
> probably not possible with existing userspace tools, but with all the new
> mount_fd and magic link apis, I can never be sure what can be made possible
> to achieve when the user holds an anonymous fd.
>
> The thinking behind adding the EXPORT_OP_LOCAL_FILE_HANDLE flag
> was that when kernfs/cgroups was added exportfs support with commit
> aa8188253474 ("kernfs: add exportfs operations"), there was no intention
> to export cgroupfs over nfs, only local to uses, but that was never enforced,
> so we thought it would be good to add this restriction and backport it to
> stable kernels.
>
> [CC patch authors]
>
> I tried to look for some property of cgroupfs that will make it not eligible
> for nfs such as the SB_KERNMOUNT and SB_NOUSER indicators, but
> as far as I can see cgroups looks like any other non-blockdev filesystem.
>
> Maybe we were wrong about the assumption that cgroupfs should be treated
> specially and deny export cgroups over nfs??
Please don't export any of the "fake" kernel filesystems (configfs,
cgroups, sysfs, debugfs, proc, etc) over nfs please. That way lies
madness and makes no sense.
thanks,
greg k-h
next prev parent reply other threads:[~2024-12-09 9:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 13:12 [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting file handles Christian Brauner
2024-12-01 13:12 ` [PATCH 1/4] exportfs: add flag to indicate local " Christian Brauner
2024-12-01 13:44 ` Amir Goldstein
2024-12-01 23:12 ` Dave Chinner
2024-12-02 9:19 ` Christian Brauner
2024-12-01 13:12 ` [PATCH 2/4] kernfs: restrict to " Christian Brauner
2024-12-01 13:12 ` [PATCH 3/4] ovl: restrict to exportable " Christian Brauner
2024-12-01 13:12 ` [PATCH 4/4] pidfs: restrict to local " Christian Brauner
2024-12-01 13:28 ` [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting " Jeff Layton
2024-12-01 16:22 ` Chuck Lever III
2024-12-03 9:08 ` Christian Brauner
2024-12-03 14:32 ` Jeff Layton
2024-12-01 13:44 ` Amir Goldstein
2024-12-05 0:38 ` Christoph Hellwig
2024-12-05 10:53 ` Christian Brauner
2024-12-05 11:57 ` Amir Goldstein
2024-12-06 16:03 ` Darrick J. Wong
2024-12-07 8:49 ` Amir Goldstein
2024-12-09 7:49 ` Christoph Hellwig
2024-12-09 8:58 ` Amir Goldstein
2024-12-09 9:16 ` Greg KH [this message]
2024-12-09 10:02 ` Amir Goldstein
2024-12-09 13:45 ` Christoph Hellwig
2024-12-09 13:46 ` Christoph Hellwig
2024-12-09 16:30 ` Amir Goldstein
2024-12-09 16:35 ` Chuck Lever
2024-12-09 17:15 ` Jeff Layton
2024-12-09 17:20 ` Chuck Lever
2024-12-10 10:13 ` Christian Brauner
2024-12-10 10:34 ` Christian Brauner
2024-12-10 11:10 ` Christoph Hellwig
2024-12-10 12:44 ` 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=2024120942-skincare-flanking-ab83@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=amir73il@gmail.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=djwong@kernel.org \
--cc=erin.shepherd@e43.eu \
--cc=hch@infradead.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=shli@fb.com \
--cc=stable@kernel.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