Re: [PATCH] dm: Use kzalloc for all structs with embedded biosets/mempools
From: David Sterba
Date: Tue Jun 05 2018 - 11:11:26 EST
On Tue, Jun 05, 2018 at 04:35:07PM +0200, David Sterba wrote:
> On Tue, Jun 05, 2018 at 08:22:22AM -0600, Jens Axboe wrote:
> > > I fucked up majorly on the bioset/mempool conversion - I forgot to check that
> > > everything biosets/mempools were being embedded in was actually being zeroed on
> > > allocation. Device mapper currently explodes, you'll probably want to apply this
> > > patch post haste.
> > >
> > > I have now done that auditing, for every single conversion - this patch fixes
> > > everything I found. There do not seem to be any incorrect ones outside of device
> > > mapper...
> > >
> > > We'll probably want a second patch that either a) changes
> > > bioset_init()/mempool_init() to zero the passed in bioset/mempool first, or b)
> > > my preference, WARN() or BUG() if they're passed memory that isn't zeroed.
> >
> > Odd, haven't seen a crash, but probably requires kasan or poisoning to
> > trigger anything? Mike's tree also had the changes, since they were based
> > on the block tree.
>
> eg. fstests/generic/081 crashes (trace below), no KASAN, PAGE_POISONING=y,
> PAGE_POISONING_NO_SANITY=y.
>
> > I can queue this up and ship it later today. Mike, you want to review
> > this one?
>
> Would be great to push that soon. The fstests build on several DM targets, the
> crashes lead to many test failures. I'm going to test the kzalloc fix now.
Tested-by: David Sterba <dsterba@xxxxxxxx>
on targets snapshot and thin.