[RFC PATCH v2 18/22] fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN
From: Eric Curtin
Date: Tue Dec 01 2026 - 22:16:43 EST
From: Ryan Roberts <ryan.roberts@xxxxxxx>
The BUILD_BUG_ON() checks that CUSE_INIT_INFO_MAX in cuse_send_init()
and the ioctl iovec array in fuse_do_ioctl() fit in a page cannot use
PAGE_SIZE, which is not a compile-time constant with arm64 boot-time
page size selection. Compare against PAGE_SIZE_MIN, the smallest page
size that can be in use, so the assumptions hold for every page size.
Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
fs/fuse/cuse.c | 2 +-
fs/fuse/ioctl.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 2538db153991..607b74731f76 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -438,7 +438,7 @@ static int cuse_send_init(struct cuse_conn *cc)
struct cuse_init_args *ia;
struct fuse_args_pages *ap;
- BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE);
+ BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE_MIN);
rc = -ENOMEM;
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index ce1807704da6..3d57c7c75055 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -246,7 +246,8 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
#endif
/* assume all the iovs returned by client always fits in a page */
- BUILD_BUG_ON(sizeof(struct fuse_ioctl_iovec) * FUSE_IOCTL_MAX_IOV > PAGE_SIZE);
+ BUILD_BUG_ON(sizeof(struct fuse_ioctl_iovec) * FUSE_IOCTL_MAX_IOV >
+ PAGE_SIZE_MIN);
err = -ENOMEM;
ap.folios = fuse_folios_alloc(fm->fc->max_pages, GFP_KERNEL, &ap.descs);