Subject: Re: [PATCH net] tls: do not return error when the tls_bigint overflows in tls_advance_record_sn()

From: Sabrina Dubroca <[email-masked]>
Date: Wed, 6 Sep 2023 17:14:42 +0200

2023-09-06, 08:02:31 -0700, Jakub Kicinski wrote:
> On Wed, 6 Sep 2023 13:02:37 +0200 Sabrina Dubroca wrote:
> > I've been running the selftests with async crypto and have collected a
> > few fixes that I was going to post this week (but not this one, since
> > we don't have a selftest for wrapping rec_seq). One of the patches
> > adds -EBUSY checks for all existing -EINPROGRESS, since the crypto API
> > can return -EBUSY as well if we're going through the backlog queue.
> 
> BTW is it possible to fake async crypto for a test or does one need 
> to have an actual accelerator?

That's what I did for my tests, forcing AESNI to go async. I'm going
to send my changes as RFC to linux-crypto@. I think syzbot would find
a few more bugs if they let it loose with forced async crypto.

Short version (without the debugfs toggles):

diff --git a/crypto/simd.c b/crypto/simd.c
index edaa479a1ec5..e3f3bf31fcca 100644
--- a/crypto/simd.c
+++ b/crypto/simd.c
@@ -317,7 +317,7 @@ static int simd_aead_encrypt(struct aead_request *req)
 	subreq = aead_request_ctx(req);
 	*subreq = *req;
 
-	if (!crypto_simd_usable() ||
+	if (true /* force async */ || !crypto_simd_usable() ||
 	    (in_atomic() && cryptd_aead_queued(ctx->cryptd_tfm)))
 		child = &ctx->cryptd_tfm->base;
 	else
@@ -338,7 +338,7 @@ static int simd_aead_decrypt(struct aead_request *req)
 	subreq = aead_request_ctx(req);
 	*subreq = *req;
 
-	if (!crypto_simd_usable() ||
+	if (true /* force async */ || !crypto_simd_usable() ||
 	    (in_atomic() && cryptd_aead_queued(ctx->cryptd_tfm)))
 		child = &ctx->cryptd_tfm->base;
 	else

-- 
Sabrina