From: Christoph Hellwig <hch@lst.de>
To: John Stultz <john.stultz@linaro.org>
Cc: Christoph Hellwig <hch@lst.de>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
Damien Le Moal <damien.lemoal@wdc.com>,
Jens Axboe <axboe@kernel.dk>, David Anderson <dvander@google.com>,
Alistair Delva <adelva@google.com>, Todd Kjos <tkjos@google.com>,
Amit Pundir <amit.pundir@linaro.org>,
YongQin Liu <yongqin.liu@linaro.org>,
lkml <linux-kernel@vger.kernel.org>,
linux-block@vger.kernel.org, Satya Tangirala <satyat@google.com>
Subject: Re: [REGRESSION] "split bio_kmalloc from bio_alloc_bioset" causing crash shortly after bootup
Date: Tue, 23 Feb 2021 08:22:52 +0100 [thread overview]
Message-ID: <20210223072252.GA18035@lst.de> (raw)
In-Reply-To: <20210223070408.GA16980@lst.de>
On Tue, Feb 23, 2021 at 08:04:08AM +0100, Christoph Hellwig wrote:
> The problem is that the blk-crypto fallback code calls bio_split
> with a NULL bioset. That was aready broken before, as the mempool
> needed to guarantee forward progress was missing, but is not fatal.
>
> Satya, can you look into adding a mempool that can guarantees forward
> progress here?
Something like this would be the minimum viable fix:
diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c
index e8327c50d7c9f4..c176b7af56a7a5 100644
--- a/block/blk-crypto-fallback.c
+++ b/block/blk-crypto-fallback.c
@@ -80,6 +80,7 @@ static struct blk_crypto_keyslot {
static struct blk_keyslot_manager blk_crypto_ksm;
static struct workqueue_struct *blk_crypto_wq;
static mempool_t *blk_crypto_bounce_page_pool;
+static struct bio_set crypto_bio_split;
/*
* This is the key we set when evicting a keyslot. This *should* be the all 0's
@@ -224,7 +225,8 @@ static bool blk_crypto_split_bio_if_needed(struct bio **bio_ptr)
if (num_sectors < bio_sectors(bio)) {
struct bio *split_bio;
- split_bio = bio_split(bio, num_sectors, GFP_NOIO, NULL);
+ split_bio = bio_split(bio, num_sectors, GFP_NOIO,
+ &crypto_bio_split);
if (!split_bio) {
bio->bi_status = BLK_STS_RESOURCE;
return false;
@@ -538,9 +540,13 @@ static int blk_crypto_fallback_init(void)
prandom_bytes(blank_key, BLK_CRYPTO_MAX_KEY_SIZE);
- err = blk_ksm_init(&blk_crypto_ksm, blk_crypto_num_keyslots);
+ err = bioset_init(&crypto_bio_split, 64, 0, 0);
if (err)
goto out;
+
+ err = blk_ksm_init(&blk_crypto_ksm, blk_crypto_num_keyslots);
+ if (err)
+ goto fail_free_bioset;
err = -ENOMEM;
blk_crypto_ksm.ksm_ll_ops = blk_crypto_ksm_ll_ops;
@@ -591,6 +597,8 @@ static int blk_crypto_fallback_init(void)
destroy_workqueue(blk_crypto_wq);
fail_free_ksm:
blk_ksm_destroy(&blk_crypto_ksm);
+fail_free_bioset:
+ bioset_exit(&crypto_bio_split);
out:
return err;
}
next prev parent reply other threads:[~2021-02-23 7:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 3:06 [REGRESSION] "split bio_kmalloc from bio_alloc_bioset" causing crash shortly after bootup John Stultz
2021-02-23 3:39 ` Chaitanya Kulkarni
2021-02-23 4:22 ` John Stultz
2021-02-23 4:58 ` Chaitanya Kulkarni
2021-02-23 7:11 ` Christoph Hellwig
2021-02-23 3:51 ` Chaitanya Kulkarni
2021-02-23 7:10 ` Christoph Hellwig
2021-02-23 7:21 ` Chaitanya Kulkarni
2021-02-23 7:37 ` Chaitanya Kulkarni
2021-02-23 15:08 ` Christoph Hellwig
2021-02-23 15:12 ` Christoph Hellwig
2021-02-23 20:53 ` Chaitanya Kulkarni
2021-02-23 7:04 ` Christoph Hellwig
2021-02-23 7:22 ` Christoph Hellwig [this message]
2021-02-23 22:46 ` John Stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210223072252.GA18035@lst.de \
--to=hch@lst.de \
--cc=adelva@google.com \
--cc=amit.pundir@linaro.org \
--cc=axboe@kernel.dk \
--cc=chaitanya.kulkarni@wdc.com \
--cc=damien.lemoal@wdc.com \
--cc=dvander@google.com \
--cc=johannes.thumshirn@wdc.com \
--cc=john.stultz@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=satyat@google.com \
--cc=tkjos@google.com \
--cc=yongqin.liu@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox