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:   Thu, 19 Oct 2023 14:10:57 +0200
From:   Jan Kara <jack@...e.cz>
To:     Joseph Qi <jiangqi903@...il.com>
Cc:     Jan Kara <jack@...e.cz>, Ted Tso <tytso@....edu>,
        linux-ext4@...r.kernel.org,
        "Ritesh Harjani (IBM)" <ritesh.list@...il.com>,
        Gao Xiang <hsiangkao@...ux.alibaba.com>,
        Dave Chinner <david@...morbit.com>,
        Joseph Qi <joseph.qi@...ux.alibaba.com>
Subject: Re: [PATCH v3] ext4: Properly sync file size update after O_SYNC
 direct IO

On Wed 18-10-23 14:45:49, Joseph Qi wrote:
> On 10/13/23 8:13 PM, Jan Kara wrote:
> > Gao Xiang has reported that on ext4 O_SYNC direct IO does not properly
> > sync file size update and thus if we crash at unfortunate moment, the
> > file can have smaller size although O_SYNC IO has reported successful
> > completion. The problem happens because update of on-disk inode size is
> > handled in ext4_dio_write_iter() *after* iomap_dio_rw() (and thus
> > dio_complete() in particular) has returned and generic_file_sync() gets
> > called by dio_complete(). Fix the problem by handling on-disk inode size
> > update directly in our ->end_io completion handler.
> > 
> > References: https://lore.kernel.org/all/02d18236-26ef-09b0-90ad-030c4fe3ee20@linux.alibaba.com
> > Reported-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
> > CC: stable@...r.kernel.org
> > Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")
> > Signed-off-by: Jan Kara <jack@...e.cz>
> 
> Tested with the reproducer after applying to 6.6-rc5,
> Tested-by: Joseph Qi <joseph.qi@...ux.alibaba.com>

Thanks for testing!

> BTW, once backported to older kernel like 5.10, it seems that it depends
> on the following commit:
> 936e114a245b iomap: update ki_pos a little later in iomap_dio_complete
> 
> Otherwise, it will fail the following xfstests cases:
> generic/091 generic/094 generic/225 generic/263 generic/311 generic/617

That is kind of curious because that commit should not influence how the
ext4 fix behaves. It only influences what is in iocb->ki_pos when we are
invalidating pagecache pages...

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists