From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
Christian Brauner <brauner@kernel.org>,
fuse-devel@lists.linux.dev, linux-fsdevel@vger.kernel.org,
David Hildenbrand <david@kernel.org>,
Dominik Maier <dmnk@google.com>
Subject: Re: [PATCH] fuse: refuse kernel-internal files as passthrough backing files
Date: Thu, 3 Dec 2026 17:59:23 +0000 [thread overview]
Message-ID: <axGt7e8yguLuMuuD@pazuzu> (raw)
In-Reply-To: <20261203175501.288404-1-amir73il@gmail.com>
On Thu, Dec 03, 2026 at 06:55:00PM +0100, Amir Goldstein wrote:
> The fuse server can register a regular file on a filesystem that only the
> kernel mounts, such as a memfd, as a backing file. Such files were never
> meant to be passthrough backing files, and some come with semantics of
> their own, such as memfd seals, which passthrough does not respect.
>
> Refuse files on filesystems mounted with SB_KERNMOUNT, as is done for
> files on pseudo filesystems.
>
> A fuse server that wants to keep the data of its backing files in memory
> can create them with O_TMPFILE on a tmpfs that it mounts. Such files
> cannot be sealed.
>
> Reported-by: Dominik Maier <dmnk@google.com>
> Closes: https://lore.kernel.org/linux-fsdevel/20261203020416.3569911-1-dmnk@google.com/
> Fixes: 44350256ab94 ("fuse: implement ioctls to manage backing files")
> Cc: stable@vger.kernel.org
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Thanks!
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>
> Miklos,
>
> FYI, Christian has already queued a similar patch for banning pseudo fs
> passthrough files [1].
>
> Note that I intentionally placed the gate outside the S_IFMT switch
> to future-proof non-regular passthrough file types.
>
> Thanks,
> Amir.
>
> [1] https://lore.kernel.org/linux-fsdevel/20261110-work-loop-pseudo-v1-38-4c998976c6c7@kernel.org/
>
> fs/fuse/backing.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c
> index 4e4fb810ddaa8..287a4b6e18526 100644
> --- a/fs/fuse/backing.c
> +++ b/fs/fuse/backing.c
> @@ -138,6 +138,9 @@ static int fuse_backing_open_file(struct fuse_conn *fc, struct fuse_backing *fb,
> struct dax_device *daxdev;
> int err;
>
> + if (inode->i_sb->s_flags & SB_KERNMOUNT)
> + return -EINVAL;
> +
> switch (inode->i_mode & S_IFMT) {
> case S_IFREG:
> /* TODO: relax CAP_SYS_ADMIN once backing files are visible to lsof */
--
Cheers, Lorenzo
prev parent reply other threads:[~2026-12-03 17:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 17:55 [PATCH] fuse: refuse kernel-internal files as passthrough backing files Amir Goldstein
2026-12-03 17:59 ` Lorenzo Stoakes (ARM) [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=axGt7e8yguLuMuuD@pazuzu \
--to=ljs@kernel.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=david@kernel.org \
--cc=dmnk@google.com \
--cc=fuse-devel@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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