[Ocfs2-devel] [PATCH 04/25] vfs: strengthen checking of file range inputs to generic_remap_checks

Christoph Hellwig hch at infradead.org
Thu Oct 11 06:43:56 PDT 2018


On Wed, Oct 10, 2018 at 09:12:46PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong at oracle.com>
> 
> File range remapping, if allowed to run past the destination file's EOF,
> is an optimization on a regular file write.  Regular file writes that
> extend the file length are subject to various constraints which are not
> checked by range cloning.
> 
> This is a correctness problem because we're never allowed to touch
> ranges that the page cache can't support (s_maxbytes); we're not
> supposed to deal with large offsets (MAX_NON_LFS) if O_LARGEFILE isn't
> set; and we must obey resource limits (RLIMIT_FSIZE).
> 
> Therefore, add these checks to the new generic_remap_checks function so
> that we curtail unexpected behavior.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong at oracle.com>
> Reviewed-by: Amir Goldstein <amir73il at gmail.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>



More information about the Ocfs2-devel mailing list