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]
Message-ID: <20120824204216.GH21325@google.com>
Date:	Fri, 24 Aug 2012 13:42:16 -0700
From:	Tejun Heo <tj@...nel.org>
To:	Kent Overstreet <koverstreet@...gle.com>
Cc:	linux-bcache@...r.kernel.org, linux-kernel@...r.kernel.org,
	dm-devel@...hat.com, vgoyal@...hat.com, mpatocka@...hat.com,
	bharrosh@...asas.com, Jens Axboe <axboe@...nel.dk>,
	Alasdair Kergon <agk@...hat.com>, Sage Weil <sage@...tank.com>
Subject: Re: [PATCH v6 13/13] block: Only clone bio vecs that are in use

Hello, Kent.

On Fri, Aug 24, 2012 at 12:05:08AM -0700, Kent Overstreet wrote:
> > I'm pretty sure I sound like a broken record by now, but
> > 
> > * How was this tested?
> > 
> > * What are the implications and possible dangers?
> 
> I've said all that on list, but I gather what you really wanted was to
> have it all in the patch description. Will do.

Yeap.

> > > @@ -463,10 +468,10 @@ void __bio_clone(struct bio *bio, struct bio *bio_src)
> > >  	bio->bi_sector = bio_src->bi_sector;
> > >  	bio->bi_bdev = bio_src->bi_bdev;
> > >  	bio->bi_flags |= 1 << BIO_CLONED;
> > > +	bio->bi_flags &= ~(1 << BIO_SEG_VALID);
> > 
> > For the n'th time, explain please.
> 
> Argh, I could've sworn I dropped that part.

Can we drop it tho?  If we're changing bvecs, we probably should be
clearing SEG_VALID on both bios.

> commit 0edda563aef9432b45f0c6a50f52590b92594560
> Author: Kent Overstreet <koverstreet@...gle.com>
> Date:   Thu Aug 23 23:26:38 2012 -0700
> 
>     block: Only clone bio vecs that are in use
>     
>     bcache creates large bios internally, and then splits them according to
>     the device requirements before it sends them down. If a lower level
>     device tries to clone the bio, and the original bio had more than
>     BIO_MAX_PAGES, the clone will fail unecessarily.
>     
>     We can fix this by only cloning the bio vecs that are actually in use -
>     as for as the block layer is concerned the new bio is still equivalent
>     to the old bio.
>     
>     This code should in general be safe as long as all the block layer code
>     uses bi_idx, bi_vcnt consistently; since bios are cloned by code that
>     doesn't own the original bio there's little room for issues caused by
>     code playing games with the original bio's bi_io_vec. One perhaps
>     imagine code depending the clone and original bio's io vecs lining up a
>     certain way, but auditing and testing haven't turned up anything.
>     
>     Testing: This code has been in the bcache tree for quite awhile, and has
>     been tested with various md layers and dm targets (including strange
>     things like multipath).

Yeap, looks much better to me.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ