lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Jan 2020 17:14:07 -0800
From:   "Darrick J. Wong" <darrick.wong@...cle.com>
To:     Ira Weiny <ira.weiny@...el.com>
Cc:     linux-kernel@...r.kernel.org,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Dan Williams <dan.j.williams@...el.com>,
        Dave Chinner <david@...morbit.com>,
        Christoph Hellwig <hch@....de>,
        "Theodore Y. Ts'o" <tytso@....edu>, Jan Kara <jack@...e.cz>,
        linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
        linux-fsdevel@...r.kernel.org
Subject: Re: [RFC PATCH V2 10/12] fs/xfs: Fix truncate up

On Mon, Jan 13, 2020 at 04:40:47PM -0800, Ira Weiny wrote:
> On Mon, Jan 13, 2020 at 02:27:55PM -0800, Darrick J. Wong wrote:
> > On Fri, Jan 10, 2020 at 11:29:40AM -0800, ira.weiny@...el.com wrote:
> > > From: Ira Weiny <ira.weiny@...el.com>
> > > 
> > > When zeroing the end of a file we must account for bytes contained in
> > > the final page which are past EOF.
> > > 
> > > Extend the range passed to iomap_zero_range() to reach LLONG_MAX which
> > > will include all bytes of the final page.
> > > 
> > > Signed-off-by: Ira Weiny <ira.weiny@...el.com>
> > > ---
> > >  fs/xfs/xfs_iops.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> > > index a2f2604c3187..a34b04e8ac9c 100644
> > > --- a/fs/xfs/xfs_iops.c
> > > +++ b/fs/xfs/xfs_iops.c
> > > @@ -910,7 +910,7 @@ xfs_setattr_size(
> > >  	 */
> > >  	if (newsize > oldsize) {
> > >  		trace_xfs_zero_eof(ip, oldsize, newsize - oldsize);
> > > -		error = iomap_zero_range(inode, oldsize, newsize - oldsize,
> > > +		error = iomap_zero_range(inode, oldsize, LLONG_MAX - oldsize,
> > 
> > Huh?  Won't this cause the file size to be set to LLONG_MAX?
> 
> Not as I understand the code.

iomap_zero_range uses the standard iomap_write_{begin,end} functions,
which means that if you pass it an (offset, length) that extend beyond
EOF it will change isize to offset+length.

> But as I said in the cover I am not 100% sure of
> this fix.

> From what I can tell xfs_ioctl_setattr_dax_invalidate() should invalidate the
> mappings and the page cache and the traces I have indicate that the DAX mode
> is not changing or was properly held off.

Hmm, that implies the invalidation didn't work.  Can you find a way to
report the contents of the page cache after the dax mode change
invalidation fails?  I wonder if this is something dorky like rounding
down such that the EOF page doesn't actually get invalidated?

Hmm, no, xfs_ioctl_setattr_dax_invalidate should be nuking all the
pages... do you have a quick reproducer?

--D

> Any other suggestions as to the problem are welcome.
> 
> Ira
> 
> 
> > 
> > --D
> > 
> > >  				&did_zeroing, &xfs_buffered_write_iomap_ops);
> > >  	} else {
> > >  		error = iomap_truncate_page(inode, newsize, &did_zeroing,
> > > -- 
> > > 2.21.0
> > > 

Powered by blists - more mailing lists