Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Diederik de Haas <didi.debian@cknow.org>,
	Ingo Franzki <ifranzki@linux.ibm.com>
Subject: Re: [PATCH v2] crypto: testmgr - reinstate kconfig control over full self-tests
Date: Fri, 13 Jun 2025 17:31:05 +0800	[thread overview]
Message-ID: <aEvv2QL-EJ3zF2XK@gondor.apana.org.au> (raw)
In-Reply-To: <20250612174709.26990-1-ebiggers@kernel.org>

On Thu, Jun 12, 2025 at 10:47:09AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Commit 698de822780f ("crypto: testmgr - make it easier to enable the
> full set of tests") removed support for building kernels that run only
> the "fast" set of crypto self-tests by default.  This assumed that
> nearly everyone actually wanted the full set of tests, *if* they had
> already chosen to enable the tests at all.
> 
> Unfortunately, it turns out that both Debian and Fedora intentionally
> have the crypto self-tests enabled in their production kernels.  And for
> production kernels we do need to keep the testing time down, which
> implies just running the "fast" tests, not the full set of tests.
> 
> For Fedora, a reason for enabling the tests in production is that they
> are being (mis)used to meet the FIPS 140-3 pre-operational testing
> requirement.
> 
> However, the other reason for enabling the tests in production, which
> applies to both distros, is that they provide some value in protecting
> users from buggy drivers.  Unfortunately, the crypto/ subsystem has many
> buggy and untested drivers for off-CPU hardware accelerators on rare
> platforms.  These broken drivers get shipped to users, and there have
> been multiple examples of the tests preventing these buggy drivers from
> being used.  So effectively, the tests are being relied on in production
> kernels.  I think this is kind of crazy (untested drivers should just
> not be enabled at all), but that seems to be how things work currently.
> 
> Thus, reintroduce a kconfig option that controls the level of testing.
> Call it CRYPTO_SELFTESTS_FULL instead of the original name
> CRYPTO_MANAGER_EXTRA_TESTS, which was slightly misleading.
> 
> Moreover, given the "production kernel" use case, make CRYPTO_SELFTESTS
> depend on EXPERT instead of DEBUG_KERNEL.
> 
> I also haven't reinstated all the #ifdefs in crypto/testmgr.c.  Instead,
> just rely on the compiler to optimize out unused code.
> 
> Fixes: 40b9969796bf ("crypto: testmgr - replace CRYPTO_MANAGER_DISABLE_TESTS with CRYPTO_SELFTESTS")
> Fixes: 698de822780f ("crypto: testmgr - make it easier to enable the full set of tests")
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> 
> This patch is targeting the crypto tree for 6.16.
> 
> Changed in v2:
>    - Made CRYPTO_SELFTESTS depend on EXPERT
>    - Removed 'default y' from CRYPTO_SELFTESTS_FULL
>    - Improved commit message
> 
>  crypto/Kconfig                 | 25 +++++++++++++++++++++----
>  crypto/testmgr.c               | 15 ++++++++++++---
>  include/crypto/internal/simd.h |  6 ++++--
>  lib/crypto/Makefile            |  2 +-
>  4 files changed, 38 insertions(+), 10 deletions(-)

Patch applied.  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:[~2025-06-13  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 17:47 [PATCH v2] crypto: testmgr - reinstate kconfig control over full self-tests Eric Biggers
2025-06-13  9:31 ` Herbert Xu [this message]

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=aEvv2QL-EJ3zF2XK@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=didi.debian@cknow.org \
    --cc=ebiggers@kernel.org \
    --cc=ifranzki@linux.ibm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox