On Mon, Sep 02, 2024 at 10:05:54AM -0700, Eric Biggers wrote: > > With both this patch "crypto: api - Fix generic algorithm self-test races" and > your other patch "crypto: algboss - Pass instance creation error up" applied, > I'm still getting errors occasionally, e.g.: > > [ 5.155587] alg: skcipher: failed to allocate transform for cbc(sm4-generic): -2 > [ 5.155954] alg: self-tests for cbc(sm4) using cbc(sm4-generic) failed (rc=-2) > [ 5.372511] alg: aead: failed to allocate transform for gcm_base(ctr(aes-generic),ghash-generic): -2 > [ 5.372861] alg: self-tests for gcm(aes) using gcm_base(ctr(aes-generic),ghash-generic) failed (rc=-2) > > I can't follow your explanation of what is going on here and what the fix is. > Would it make any sense to just revert the commits that introduced this problem? As I said earlier, these errors are expected. What's happening is this: __ecb-sm4-aesni-avx gets registered (but not tested) cbc(sm4-generic) gets registered (but not tested) __ecb-sm4-aesni-avx finishes testing with lskcipher this is equivalent to crypto_cipher sm4 so it triggers the destruction of all instances of sm4 cbc(sm4-generic) gets marked as dead cbc(sm4-generic) fails self-test because it's already dead (ENOENT) It's harmless because whatever that is asking for cbc(sm4-generic) (in this case it's the extra-test mechanism) will simply retry the allocation which will then succeed. I will send a patch to disable the warning when allocating X returns ENOENT while we're testing X itself. This can always happen if X gets killed for the reason mentioned above and it's perfectly harmless. It's just that the race window was tiny previously because testing occurred immediately after registration. But now we've magnified that window many times with asynchronous testing. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt