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] [day] [month] [year] [list]
Message-ID: <20210319041621.GB1431129@xiangao.remote.csb>
Date:   Fri, 19 Mar 2021 12:16:21 +0800
From:   Gao Xiang <hsiangkao@...hat.com>
To:     Chao Yu <yuchao0@...wei.com>
Cc:     Gao Xiang <hsiangkao@....com>, linux-erofs@...ts.ozlabs.org,
        Chao Yu <chao@...nel.org>, linux-kernel@...r.kernel.org,
        Martin DEVERA <devik@...labs.cz>
Subject: Re: [PATCH v2] erofs: fix bio->bi_max_vecs behavior change

Hi Chao,

On Fri, Mar 19, 2021 at 10:15:18AM +0800, Chao Yu wrote:
> On 2021/3/6 12:04, Gao Xiang wrote:

...

> > +	    (*last_block + 1 != current_block || !*eblks)) {
> 
> Xiang,
> 
> I found below function during checking bi_max_vecs usage in f2fs:
> 
> /**
>  * bio_full - check if the bio is full
>  * @bio:        bio to check
>  * @len:        length of one segment to be added
>  *
>  * Return true if @bio is full and one segment with @len bytes can't be
>  * added to the bio, otherwise return false
>  */
> static inline bool bio_full(struct bio *bio, unsigned len)
> {
>         if (bio->bi_vcnt >= bio->bi_max_vecs)
>                 return true;
> 
>         if (bio->bi_iter.bi_size > UINT_MAX - len)
>                 return true;
> 
>         return false;
> }
> 
> Could you please check that whether it will be better to use bio_full()
> rather than using left-space-in-bio maintained by erofs itself? something
> like:
> 
> if (bio && (bio_full(bio, PAGE_SIZE) ||
> 	/* not continuous */
> 	(*last_block + 1 != current_block))
> 
> I'm thinking we need to decouple bio detail implementation as much as
> possible, to avoid regression whenever bio used/max size definition
> updates, though I've no idea how to fix f2fs case.

Thanks for your suggestion.

Not quite sure I understand the idea... The original problem was that
when EROFS bio_alloc, the number of requested bvec also partially stood
for remaining blocks of the current on-disk extent to limit the read
length. but after that bio behavior change, bi_max_vec could be increased
internally by block layer (e.g. 1 --> 4), so bi_max_vecs is no longer
as what we expect (I mean passed-in). so could cause read request
out-of-bound or hung. That's why I decided to record it manually (never
rely on bio statistics anymore...)

Also btw, AFAIK, Jianan is still investigating to use iomap instead
(mainly resolve tail-packing inline path). And I'm also busy in big
pcluster and LZMA new features for the next cycle. So I think we might
leave it just as is and it would be replaced with iomap in the future.

Thanks,
Gao Xiang

> 
> Let me know if you have other concern.
> 
> Thanks,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ