[PATCH RFC v3 40/44] fuse: refuse files on pseudo filesystems as passthrough backing files
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Nov 16 11:26:05 UTC 2026
> The fuse server can register any regular file as a backing file. procfs
> and binfmt_misc files are already refused by the stacking depth check as
> both set s_stack_depth to FILESYSTEM_MAX_STACK_DEPTH. sysfs and the
> other pseudo filesystems aren't. Reads and writes of the fuse file would
> then be done on the pseudo file with the fuse server's credentials.
> Refuse files on pseudo filesystems just like loop does.
>
> Note that the backing file is only registered here and opened again for
> every fuse file that uses it. Only its path is used and O_PATH file
> descriptors are allowed since commit efad7153bf93 ("fuse: allow O_PATH
> fd for FUSE_DEV_IOC_BACKING_OPEN"). So pass FMODE_PATH to
> file_check_backing() to keep them working.
>
> The file that reads and writes are actually done on is opened in
> fuse_passthrough_open() with the flags of the fuse file. So check that
> file as well and pass the mode the fuse file was opened with. It has
> the same path as the registered file so files on pseudo filesystems are
> already refused. But this also makes sure that the backing file
> implements ->read_iter() if the fuse file is opened for reading and
> ->write_iter() if it is opened for writing. Like the other failures to
> set up passthrough this fails the open with EIO.
>
> Reviewed-by: Amir Goldstein <amir73il at gmail.com>
> Suggested-by: Amir Goldstein <amir73il at gmail.com>
> Link: https://lore.kernel.org/all/CAOQ4uxhGxpBtMZ5kfuzR1tQAewiecoX7UjXQRo91QjJHH9T_Yw@mail.gmail.com
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-work-loop-pseudo-v3-0-8cbbea1cf34f@kernel.org?part=40
More information about the Linux-security-module-archive
mailing list