From 2317d8602334093ea0c88efee2e6ac326d42adc7 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 5 Aug 2025 20:31:53 +0200 Subject: libfuse: fix COPY_FILE_RANGE interface The FUSE protocol uses struct fuse_write_out to convey the return value of copy_file_range, which is restricted to uint32_t. But the COPY_FILE_RANGE interface supports a 64-bit size copies. Currently the number of bytes copied is silently truncated to 32-bit, which is unfortunate at best. Implement the COPY_FILE_RANGE_64 interface which is identical to the old one, except the number of bytes copied is returned in a 64-bit value. The library interface remains the same. If the kernel does not support the new interface or the server is running as a 32-bit process, limit the copy size to size to UINT_MAX - 4096. Edit by Bernd: Keep ioctl_64bit and add use new bit is_copy_file_range_64 to keep flags separated from each other - easier code readability IMO. Reported-by: Florian Weimer Closes: https://lore.kernel.org/all/lhuh5ynl8z5.fsf@oldenburg.str.redhat.com/ Signed-off-by: Miklos Szeredi Signed-off-by: Bernd Schubert --- lib/fuse_i.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/fuse_i.h') diff --git a/lib/fuse_i.h b/lib/fuse_i.h index 0d0e637..d3d86d4 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -40,6 +40,7 @@ struct fuse_req { int interrupted; unsigned int ioctl_64bit : 1; unsigned int is_uring : 1; + unsigned int is_copy_file_range_64 : 1; union { struct { uint64_t unique; -- cgit v1.2.3