On Sat, Oct 1, 2022 at 1:03 AM Paul Lawrence <paullawrence@xxxxxxxxxx> wrote: > > On Tue, Sep 27, 2022 at 11:19 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote: > > > > On Tue, 27 Sept 2022 at 01:18, Daniel Rosenberg <drosen@xxxxxxxxxx> wrote: > > > > > diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h > > > index d6ccee961891..8c80c146e69b 100644 > > > --- a/include/uapi/linux/fuse.h > > > +++ b/include/uapi/linux/fuse.h > > > @@ -572,6 +572,17 @@ struct fuse_entry_out { > > > struct fuse_attr attr; > > > }; > > > > > > +#define FUSE_ACTION_KEEP 0 > > > +#define FUSE_ACTION_REMOVE 1 > > > +#define FUSE_ACTION_REPLACE 2 > > > + > > > +struct fuse_entry_bpf_out { > > > + uint64_t backing_action; > > > + uint64_t backing_fd; > > > > This is a security issue. See this post from Jann: > > > > https://lore.kernel.org/all/CAG48ez17uXtjCTa7xpa=JWz3iBbNDQTKO2hvn6PAZtfW3kXgcA@xxxxxxxxxxxxxx/ > > > > The fuse-passthrough series solved this by pre-registering the > > passthrogh fd with an ioctl. Since this requires an expicit syscall on > > the server side the attack is thwarted. > > > > It would be nice if this mechanism was agreed between these projects. > > > > BTW, does fuse-bpf provide a superset of fuse-passthrough? I mean > > could fuse-bpf work with a NULL bpf program as a simple passthrough? > > > > Thanks, > > Miklos > > To deal with the easy part. Yes, fuse-bpf can take a null bpf program, and > if you install that on files, it should behave exactly like bpf passthrough. > > Our intent is that all accesses to the backing files go through the normal > vfs layer checks, so even once a backing file is installed, it can only be > accessed if the client already has sufficient rights. However, the same > statement seems to be true for the fuse passthrough code so I assume > that is not sufficient. I would be interested in further understanding the > remaining security issue (or is it defense in depth?) We understand that > the solution in fuse passthrough was to change the response to a fuse open > to be an ioctl? This would seem straightforward in fuse-bpf as well if it is > needed, though of course it would be in the lookup. Not only in lookup. In lookup userspace can install an O_PATH fd for backing_path, but userspace will also need to install readable/writeable fds as backing_file to be used by open to match the open mode. When talking about the server-less passthrough mode, some security model like overlayfs mounter creds model will need to be employed, although in the private case of one-to-one passthrough I guess using the caller creds should be good enough, as long as the security model is spelled out and implementation is audited. Thanks, Amir.