Re: [PATCH 1/2] fuse: fix COPY_FILE_RANGE interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 07, 2025 at 02:24:25PM +0800, Chunsheng Luo wrote:
> 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.

if (WARN_ON_ONCE(bytes_copied > len))
	return -EIO;

perhaps?

--D

> 
> Thanks
> Chunsheng Luo
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux