On Thu, Jun 12, 2025 at 10:47:09AM -0700, Eric Biggers wrote: > From: Eric Biggers <ebiggers@xxxxxxxxxx> > > 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@xxxxxxxxxx> > --- > > 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@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt