public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* linux-next/crypto: Problem with loading paes_s390x kernel cipher since commit "crypto: api - Fix generic algorithm self-test races"
@ 2024-09-17  7:31 Ingo Franzki
  2024-09-17  9:29 ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Franzki @ 2024-09-17  7:31 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, linux-crypto, linux-s390, Harald Freudenberger,
	Holger Dengler

Hi Herbert,

we noticed a failure on linux-next in our CI that came in within the last few days.
We do a relatively simple command to open a dm-crypt device using the s390x specific PAES kernel cipher:

# cryptsetup plainOpen --key-file /sys/devices/virtual/misc/pkey/protkey/protkey_aes_128 --key-size 640 --cipher paes-cbc-plain64  /dev/loop0 enc-loop

This fails when the paes_s390x kernel module has not yet been loaded with the following:

device-mapper: reload ioctl on enc-loop (251:23) failed: No such file or directory

and the following on syslog:

kernel: device-mapper: table: 251:23: crypt: Error allocating crypto tfm (-ENOENT)
kernel: device-mapper: ioctl: error adding target to table

After that, the paes_s390x kernel module has been loaded, all self-tests have passed, and retrying the same command works fine.
So the problem only happens when dm-crypt is requesting the paes cipher, and it is not yet available.
This does trigger the paes_s390x kernel module to be loaded (it has an MODULE_ALIAS_CRYPTO("paes") included), but allocating the tfm fails anyway.

I can easily trigger the problem again by removing the paes_s390x kernel module via rmmod. After that the above command fails again.

I looked at the recent commits for the crypto sub-directory and reverted some of them to see if it makes a difference.

Reverting "crypto: testmgr - Hide ENOENT errors" (4eded6d14f5b7bb857b68872970a40cf3105c015) does not make a difference.

When reverting "crypto: algboss - Pass instance creation error up" (795f85fca229a88543a0a706039f901106bf11c1) it still fails, but it behaves differently.
It now times out after a while instead of failing right away:

# cryptsetup plainOpen --key-file /sys/devices/virtual/misc/pkey/protkey/protkey_aes_128 --key-size 640 --cipher paes-cbc-plain64  /dev/loop0 enc-loop
device-mapper: reload ioctl on enc-loop (251:0) failed: Connection timed out

Syslog:

kernel: device-mapper: table: 251:0: crypt: Error allocating crypto tfm (-ETIMEDOUT)
kernel: device-mapper: ioctl: error adding target to table

Finally, when I also revert "crypto: api - Fix generic algorithm self-test races" (e7a4142b35ce489fc8908d75596c51549711ade0) it starts to work again.

Not sure if the paes_s390x kernel module is doing something special which makes it fail with your changes, or what else is causing this.
Anyway, this looks like a regression caused by these recent commits.

Kind regards,
Ingo

-- 
Ingo Franzki
eMail: ifranzki@linux.ibm.com  
Tel: ++49 (0)7031-16-4648
Linux on IBM Z Development, Schoenaicher Str. 220, 71032 Boeblingen, Germany

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM DATA Privacy Statement: https://www.ibm.com/privacy/us/en/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-09-18  8:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17  7:31 linux-next/crypto: Problem with loading paes_s390x kernel cipher since commit "crypto: api - Fix generic algorithm self-test races" Ingo Franzki
2024-09-17  9:29 ` Herbert Xu
2024-09-17  9:54   ` Ingo Franzki
2024-09-18  4:01     ` [PATCH] crypto: s390/paes - Fix module aliases Herbert Xu
2024-09-18  6:50       ` Ingo Franzki
2024-09-18  8:20         ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox