public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Eric Biggers <ebiggers@kernel.org>
Cc: agk@redhat.com, snitzer@kernel.org, dm-devel@lists.linux.dev,
	linux-crypto@vger.kernel.org, gilad@benyossef.com,
	samitolvanen@google.com
Subject: Re: [PATCH] dm-verity: hash blocks with shash import+finup when possible
Date: Thu, 2 Nov 2023 12:43:31 +0800	[thread overview]
Message-ID: <ZUMo87EMeYxiCZLX@gondor.apana.org.au> (raw)
In-Reply-To: <20231101054856.GA140941@sol.localdomain>

On Tue, Oct 31, 2023 at 10:48:56PM -0700, Eric Biggers wrote:
>
> Note that dm-verity also has to use an ugly and error-prone workaround to use
> ahash at all, since its hash blocks can be cached in vmalloc memory; see
> verity_hash_update().  shash handles vmalloc memory much more naturally, since
> no translation from vmalloc address to page to linear address is needed.

So why not drop ahash and always use shash? Does anybody care about
offload for dm-verity?

Alternatively, we could incorporate this into ahash itself.  Then
you could have an optimised code path that does not do SGs if the
underlying algorithm is shash.

I really do not wish to see this ahash/shash paradigm proliferate.

> > On a side note, if we're going to use shash for bulk data then we
> > should reintroduce the can/cannot sleep flag.
> 
> This patch limits the use of shash to blocks of at most PAGE_SIZE (*), which is
> the same as what ahash does internally.
> 
> (*) Except when the data block size is <= PAGE_SIZE but the hash block size is
>     > PAGE_SIZE.  I think that's an uncommon configuration that's not worth
>     worrying too much about, but it could be excluded from the shash-based code.

OK.  But we do still have the module signature verification code
path and I think that one still needs the can-sleep flag.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2023-11-02  4:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30  2:33 [PATCH] dm-verity: hash blocks with shash import+finup when possible Eric Biggers
2023-10-30 22:41 ` Sami Tolvanen
2023-11-01  4:51 ` Herbert Xu
2023-11-01  5:48   ` Eric Biggers
2023-11-02  4:43     ` Herbert Xu [this message]
2023-11-02  5:40       ` Eric Biggers
2023-11-06 10:11         ` Herbert Xu

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=ZUMo87EMeYxiCZLX@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=agk@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=gilad@benyossef.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=snitzer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox