All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Bart Van Assche <bvanassche@acm.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v3 0/7] Fix bio splitting by the crypto fallback code
Date: Thu, 17 Jul 2025 06:43:42 +0200	[thread overview]
Message-ID: <20250717044342.GA26995@lst.de> (raw)
In-Reply-To: <20250715214456.GA765749@google.com>

On Tue, Jul 15, 2025 at 09:44:56PM +0000, Eric Biggers wrote:
> Overall, it's a bit frustrating seeing these patches go by that propose
> to silently leave data unencrypted when upper layers requested that it
> be encrypted.  IMO this is actually a point against handling encryption
> in the block layer...  The whole point of storage encryption (whether
> fscrypt, dm-crypt, dm-inlinecrypt, or something else) is that the data
> is actually encrypted.  But if the actual encryption is done using code
> whose developers / maintainers don't really consider encryption to be a
> priority, that's not a great place to be.

Getting back to this.  While the ton is a bit snarky, it brings up a good
point.  Relying on the block layer to ensure that data is always
encrypted seems like a bad idea, given that is really not what the block
layer is about, and definitively not high on the mind of anyone touching
the code.  So I would not want to rely on the block layer developers to
ensure that data is encrypted properly through APIs not one believes part
that mission.

So I think you'd indeed be much better off not handling the (non-inline)
incryption in the block layer.

Doing that in fact sounds pretty easy - instead of calling the
blk-crypto-fallback code from inside the block layer, call it from the
callers instead of submit_bio when inline encryption is not actually
supported, e.g.

	if (!blk_crypto_config_supported(bdev, &crypto_cfg))
		blk_crypto_fallback_submit_bio(bio);
	else
		submit_bio(bio);

combined with checks in the low-level block code that we never get a
crypto context into the low-level submission into ->submit_bio or
->queue_rq when not supported.

That approach not only is much easier to verify for correct encryption
operation, but also makes things like bio splitting and the required
memory allocation for it less fragile.

  parent reply	other threads:[~2025-07-17  4:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 20:10 [PATCH v3 0/7] Fix bio splitting by the crypto fallback code Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 1/7] block: Improve blk_crypto_fallback_split_bio_if_needed() Bart Van Assche
2025-07-16 11:49   ` John Garry
2025-07-16 17:20     ` Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 2/7] block: Split blk_crypto_fallback_split_bio_if_needed() Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 3/7] block: Modify the blk_crypto_bio_prep() calling convention Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 4/7] block: Modify the blk_crypto_fallback_bio_prep() " Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 5/7] block: Change the blk_crypto_fallback_encrypt_bio() " Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 6/7] block: Rework splitting of encrypted bios Bart Van Assche
2025-07-15 20:10 ` [PATCH v3 7/7] block, crypto: Remove crypto_bio_split Bart Van Assche
2025-07-15 21:44 ` [PATCH v3 0/7] Fix bio splitting by the crypto fallback code Eric Biggers
2025-07-15 22:35   ` Bart Van Assche
2025-07-16  1:14     ` Eric Biggers
2025-07-16 11:25   ` Christoph Hellwig
2025-07-17  4:43   ` Christoph Hellwig [this message]
2025-07-17 17:58     ` Bart Van Assche
2025-07-18  8:17       ` Christoph Hellwig
2025-07-18 15:37     ` Bart Van Assche
2025-07-18 16:50       ` Eric Biggers
2025-07-21  6:01         ` Christoph Hellwig
2025-07-16 16:12 ` Bart Van Assche

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=20250717044342.GA26995@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=ebiggers@kernel.org \
    --cc=linux-block@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.