linux/fs/fuse
Joanne Koong cc6f804e78 fuse: don't clear folio uptodate on writethrough errors
In the writethrough path (fuse_send_write_pages()), if the write to the
server failed or was a short write, the uptodate flag on the folios are
cleared.

As explained by Matthew in [1], this is dangerous because the folio may
be mapped into userspace. The mm code has the invariant that a
non-uptodate folio must never be visible to userspace (to avoid
potentially leaking confidental information to userspace) and has checks
in place for this that if violated can bring down the whole machine.

Practically speaking, the effect of this change for the fuse
writethrough error path is that if an application does a write and then
the server fails to persist the data or only services a short write, the
page cache folio keeps the data the application wrote instead of being
reverted to the server's contents on the next read. The failure is still
reported to the application synchronously through the short count /
error return of the write() syscall. Folios that were only partially
written are unaffected since they were never marked uptodate in the
first place (fuse_fill_write_page() only marks a folio as uptodate if
the whole folio was written to).

[1] https://lore.kernel.org/linux-fsdevel/ajtPMgO65FA1TXhi@casper.infradead.org/

Suggested-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
History 2026-07-08 11:12:48 +02:00
..
acl.c fuse: Add SPDX ID lines to some files 2026-06-15 14:06:19 +02:00
args.h fuse: remove fm arg of args->end callback 2026-06-15 14:06:17 +02:00
backing.c fuse: use current creds for backing files 2026-06-15 14:06:19 +02:00
control.c fuse: Add SPDX ID lines to some files 2026-06-15 14:06:19 +02:00
cuse.c fuse: change fud->fc to fud->chan 2026-06-15 14:06:17 +02:00
dax.c fuse: dax: Move long delayed work on system_dfl_long_wq 2026-06-15 14:06:19 +02:00
dev.c fuse: clean up interrupt reading 2026-06-15 14:06:20 +02:00
dev.h fuse: remove #include "fuse_i.h" from dev.c and dev_uring.c 2026-06-15 14:06:18 +02:00
dev_uring.c fuse-uring: clear ent->fuse_req in commit_fetch error path 2026-06-15 14:19:45 +02:00
dev_uring_i.h fuse-uring: drop kernel-doc notation for a comment 2026-06-15 14:06:18 +02:00
dir.c fuse: move "epoch" from dentry.d_time to fuse_dentry.epoch 2026-07-06 15:44:58 +02:00
file.c fuse: don't clear folio uptodate on writethrough errors 2026-07-08 11:12:48 +02:00
fuse_dev_i.h fuse: fuse_dev_i.h: clean up kernel-doc warnings 2026-06-15 14:06:18 +02:00
fuse_i.h fuse: move "epoch" from dentry.d_time to fuse_dentry.epoch 2026-07-06 15:44:58 +02:00
fuse_trace.h fuse: add fuse_request_sent tracepoint 2026-06-15 14:06:19 +02:00
inode.c fuse: Add SPDX ID lines to some files 2026-06-15 14:06:19 +02:00
ioctl.c fuse: replace __get_free_page() with kmalloc() 2026-05-27 15:12:24 +02:00
iomode.c fuse: remove unused 'inode' parameter in fuse_passthrough_open 2025-08-27 14:29:44 +02:00
Kconfig fuse: fix references to fuse.rst -> fuse/fuse.rst 2025-09-02 11:14:15 +02:00
Makefile fuse: create notify.c 2026-06-15 14:06:17 +02:00
notify.c fuse update for 7.2 2026-06-18 08:50:52 -07:00
passthrough.c lsm: add backing_file LSM hooks 2026-04-03 16:53:50 -04:00
poll.c fuse: create poll.c 2026-06-15 14:06:17 +02:00
readdir.c fuse: move "epoch" from dentry.d_time to fuse_dentry.epoch 2026-07-06 15:44:58 +02:00
req.c fuse: split out filesystem part of request sending 2026-06-15 14:06:17 +02:00
req_timeout.c fuse: abort related layering cleanup 2026-06-15 14:06:17 +02:00
sysctl.c fuse: move request timeout code to a new source file 2026-06-15 14:06:15 +02:00
sysctl.h fuse: move request timeout code to a new source file 2026-06-15 14:06:15 +02:00
trace.c fuse: move CREATE_TRACE_POINTS to a separate file 2025-09-25 16:22:18 +02:00
virtio_fs.c virtio-fs: avoid double-free on failed queue setup 2026-06-15 14:06:20 +02:00
xattr.c fuse: Add SPDX ID lines to some files 2026-06-15 14:06:19 +02:00