On Sat, Feb 23, 2019 at 07:33:21AM +0800, Ming Lei wrote: > Hi Carlos, > > Cc block list given it is related with interface between fs and block layer. > > On Fri, Feb 22, 2019 at 10:14 PM Carlos Maiolino <cmaiolino@xxxxxxxxxx> wrote: > > > > guard_bio_eod() can truncate a segment in bio to allow it to do IO on > > odd last sectors of a device. > > > > It already checks if the IO starts past EOD, but it does not consider > > the possibility of an IO request starting within device boundaries can > > contain more than one segment past EOD. > > > > In such cases, truncated_bytes can be bigger than PAGE_SIZE, and will > > underflow bvec->bv_len. > > It can cause memory corruption even for < PAGE_SIZE, also it can be correct > to see > PAGE_SIZE truncated_bytes: > > - xfs is going to support big block size which may be 64k FYI, this isn't an XFS problem and never will be - XFS doesn't use bufferheads and mpage_readpages() anymore, it goes down the iomap_readpages() path which does not need this whacky guard_bio_eod() thingy. > - suppose fs block size is 4k, bio sector is 1022 and size is 4k, and > disk size is > 1024, XFS won't do that, either - it checks at mount time if it can read the very last sector of the filesystem via uncached IO (see xfs_check_sizes() and xfs_rtmount_init()). If any of the EOD reads fail, it won't mount. Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx