Skip to contentSkip to conversation

fuse: stop stealing pipe pages into the page cache

PATCH In review Abdifatah Suruur 1 participant 2 messages Nov 18

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: stop stealing pipe pages into the page cache

The SPLICE_F_MOVE path in fuse_dev_splice_write() allows a FUSE server to move arbitrary pages from a splice pipe into the FUSE file's page cache. Those pipe pages can be page-cache folios of a different file, pages written by userspace, or gifted anonymous pages. Replacing a FUSE cache folio with such a page breaks page-cache aliasing, refcounting, dirty tracking and writeback, and can be used to corrupt or disclose data from other files.

The checks in fuse_check_folio() are racy and cannot make this safe. Remove page stealing entirely: always copy the data into the FUSE page cache folio, and drop the move_folios/page_replace plumbing. FUSE_SPLICE_MOVE remains advertised for compatibility.

---

fs/fuse/args.h +0 -1
index 5173264a1261b..36ef0c6d59998 100644
@@ -36,7 +36,6 @@ struct fuse_args {
 	bool user_pages:1;
 	bool out_argvar:1;
 	bool page_zeroing:1;
-	bool page_replace:1;
 	bool may_block:1;
 	bool is_ext:1;
 	bool is_pinned:1;
fs/fuse/dev.c +3 -141

180 lines not on this page · raw message

fs/fuse/file.c +0 -1
index d5e1cb53d86a6..ab955e4c3e5d7 100644
@@ -1096,7 +1096,6 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file,
 
 	ap->args.out_pages = true;
 	ap->args.page_zeroing = true;
-	ap->args.page_replace = true;
 
 	/*
 	 * Don't overflow end offset.
fs/fuse/fuse_dev_i.h +0 -1
index 4b412a76225f8..a90ce26ded319 100644
@@ -326,7 +326,6 @@ struct fuse_copy_state {
 	unsigned int len;
 	unsigned int offset;
 	bool write:1;
-	bool move_folios:1;
 	bool is_uring:1;
 	/* set when the payload is zero-copied. folios are filled in place */
 	bool skip_folio_copy:1;
#1 lore raw

Hello,

Please ignore/drop my patch "fuse: stop stealing pipe pages into the page cache" (message-id <[email protected]>). After further checking I found that this issue has already been reported and fixed upstream by commit 80beb226de50b859913a55be0d6bff9046662294, which predates my submission. I should have checked the post-snapshot history more carefully; my patch is redundant. Sorry for the noise.

Thanks,
Abdifatah Suruur
[email protected]