From: Chunsheng Luo <luochunsheng@ustc.edu>
To: mszeredi@redhat.com
Cc: bschubert@ddn.com, fweimer@redhat.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface
Date: Thu, 7 Aug 2025 14:24:25 +0800 [thread overview]
Message-ID: <20250807062425.694-1-luochunsheng@ustc.edu> (raw)
In-Reply-To: <20250805183017.4072973-1-mszeredi@redhat.com>
On Thu, Aug 07 2025, Chunsheng Luo wrote:
> On Tue, Aug 05 2025, Miklos Szeredi wrote:
>
> + bytes_copied = fc->no_copy_file_range_64 ?
> + outarg.size : outarg_64.bytes_copied;
> +
> truncate_inode_pages_range(inode_out->i_mapping,
> ALIGN_DOWN(pos_out, PAGE_SIZE),
> - ALIGN(pos_out + outarg.size, PAGE_SIZE) - 1);
> + ALIGN(pos_out + bytes_copied, PAGE_SIZE) - 1);
>
> file_update_time(file_out);
> - fuse_write_update_attr(inode_out, pos_out + outarg.size, outarg.size);
> + fuse_write_update_attr(inode_out, pos_out + bytes_copied, bytes_copied);
The copy_file_range syscall returns bytes_copied, a value provided by the userspace filesystem that the kernel cannot control. If bytes_copied > len, how should the application handle this? Similarly, if pos_out + bytes_copied < pos_outdue to integer overflow, could this cause any issues? Since vfs_copy_file_range->generic_copy_file_checks already check that pos_out + len does not overflow, so just need check bytes_copied > len.
Thanks
Chunsheng Luo
next prev parent reply other threads:[~2025-08-07 6:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 18:30 [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface Miklos Szeredi
2025-08-05 18:30 ` [PATCH 2/2] copy_file_range: limit size if in compat mode Miklos Szeredi
2025-08-12 11:21 ` Miklos Szeredi
2025-08-15 14:22 ` Christian Brauner
2025-08-12 14:26 ` Amir Goldstein
2025-08-12 15:50 ` Miklos Szeredi
2025-08-06 9:17 ` [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface Luis Henriques
2025-08-06 16:01 ` Darrick J. Wong
2025-08-06 19:48 ` Luis Henriques
2025-08-11 15:45 ` Darrick J. Wong
2025-08-06 19:43 ` Bernd Schubert
2025-08-12 9:08 ` Chunsheng Luo
2025-08-12 19:49 ` Darrick J. Wong
2025-08-07 6:24 ` Chunsheng Luo [this message]
2025-08-11 15:47 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250807062425.694-1-luochunsheng@ustc.edu \
--to=luochunsheng@ustc.edu \
--cc=bschubert@ddn.com \
--cc=fweimer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mszeredi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).