Skip to contentSkip to conversation

WARNING: CPU: 1 PID: 81 at crypto/testmgr.c:5931 alg_test+0x2a4/0x300 (Thinkpad T60, v6.12-rc2)

DISCUSSION Erhard Furtner 2 participants 4 messages Oct 9, 2024 – Oct 16, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Greetings!

On kernel v6.12-rc2 this warning shows up at boot on my Thinkpad T60:

[...]
alg: akcipher: decrypt test failed. err -1
alg: akcipher: test 1 failed for rsa-generic, err=-1
alg: self-tests for rsa using rsa-generic failed (rc=-1)

------------[ cut here ]------------
alg: self-tests for rsa using rsa-generic failed (rc=-1)
WARNING: CPU: 1 PID: 81 at crypto/testmgr.c:5931 alg_test+0x2a4/0x300
Modules linked in:
CPU: 1 UID: 0 PID: 81 Comm: cryptomgr_test Not tainted 6.12.0-rc2-P3 #3
Hardware name: LENOVO 2007F2G/2007F2G, BIOS 79ETE7WW (2.27 ) 03/21/2011
EIP: alg_test+0x2a4/0x300
Code: 53 68 0b 27 9a c9 e8 e3 7f 3e 00 83 c4 10 89 f0 be fe ff ff ff 83 ff fe 74 9b 57 50 53 68 cd 80 9a c9 e8 37 a2 cb ff 83 c4 10 <0f> 0b 89 fe eb 85 68 ef 66 95 c9 53 56 68 ce 89 9b c9 e8 7d 7d 3e
EAX: 00000000 EBX: c1d2fa80 ECX: 00000000 EDX: 00000000
ESI: fffffffe EDI: ffffffff EBP: c1a4bf60 ESP: c1a4bec8
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010282
CR0: 80050033 CR2: 00000000 CR3: 09b7c000 CR4: 000006f0
Call Trace:
 ? show_regs+0x4e/0x5c
 ? __warn+0x87/0xdc
 ? alg_test+0x2a4/0x300
 ? report_bug+0x94/0x108
 ? exc_overflow+0x3c/0x3c
 ? handle_bug+0x41/0x60
 ? exc_invalid_op+0x17/0x40
 ? handle_exception+0x101/0x101
 ? exc_overflow+0x3c/0x3c
 ? alg_test+0x2a4/0x300
 ? exc_overflow+0x3c/0x3c
 ? alg_test+0x2a4/0x300
 ? __switch_to_asm+0x88/0xe4
 ? __switch_to_asm+0x82/0xe4
 ? __switch_to_asm+0x7c/0xe4
 ? __switch_to_asm+0x76/0xe4
 ? __switch_to_asm+0x70/0xe4
 ? __switch_to_asm+0x6a/0xe4
 ? __switch_to_asm+0x64/0xe4
 ? __switch_to_asm+0x5e/0xe4
 ? __switch_to_asm+0x58/0xe4
 ? __switch_to_asm+0x52/0xe4
 ? __switch_to_asm+0x4c/0xe4
 ? __switch_to_asm+0x46/0xe4
 ? _raw_spin_unlock+0x8/0xc
 ? finish_task_switch+0x98/0x244
 ? __switch_to_asm+0x1c/0xe4
 ? __switch_to_asm+0x16/0xe4
 ? __schedule+0x587/0x7a4
 cryptomgr_test+0x1c/0x38
 kthread+0xc4/0xd0
 ? crypto_alg_put+0x40/0x40
 ? kthread_blkcg+0x24/0x24
 ? kthread_blkcg+0x24/0x24
 ret_from_fork+0x31/0x3c
 ret_from_fork_asm+0x12/0x18
 entry_INT80_32+0xf0/0xf0
---[ end trace 0000000000000000 ]---

Some data about the cpu:

 $ lscpu 
Architecture:             i686
  CPU op-mode(s):         32-bit
  Address sizes:          32 bits physical, 32 bits virtual
  Byte Order:             Little Endian
CPU(s):                   2
  On-line CPU(s) list:    0,1
Vendor ID:                GenuineIntel
  Model name:             Genuine Intel(R) CPU           T2400  @ 1.83GHz
    CPU family:           6
    Model:                14
    Thread(s) per core:   1
    Core(s) per socket:   2
    Socket(s):            1
    Stepping:             8
    CPU(s) scaling MHz:   54%
    CPU max MHz:          1833,0000
    CPU min MHz:          1000,0000
    BogoMIPS:             3658,74
    Flags:                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush 
                          dts acpi mmx fxsr sse sse2 ht tm pbe nx constant_tsc arch_perfmon bts 
                          cpuid aperfmperf pni monitor vmx est tm2 xtpr pdcm pti dtherm
Virtualization features:  
  Virtualization:         VT-x
Caches (sum of all):      
  L1d:                    64 KiB (2 instances)
  L1i:                    64 KiB (2 instances)
  L2:                     2 MiB (1 instance)

The kernel was built with clang-19/lld-19. Kernel .config attached. Full dmesg can be provided if needed.

Regards,
Erhard

#1 lore raw
Quoted 49 lines · On Thu, 10 Oct 2024 01:38:29 +0200 Erhard Furtner <[email protected]> wrote:

On kernel v6.12-rc2 this warning shows up at boot on my Thinkpad T60:

[...]
alg: akcipher: decrypt test failed. err -1
alg: akcipher: test 1 failed for rsa-generic, err=-1
alg: self-tests for rsa using rsa-generic failed (rc=-1)

------------[ cut here ]------------
alg: self-tests for rsa using rsa-generic failed (rc=-1)
WARNING: CPU: 1 PID: 81 at crypto/testmgr.c:5931 alg_test+0x2a4/0x300
Modules linked in:
CPU: 1 UID: 0 PID: 81 Comm: cryptomgr_test Not tainted 6.12.0-rc2-P3 #3
Hardware name: LENOVO 2007F2G/2007F2G, BIOS 79ETE7WW (2.27 ) 03/21/2011
EIP: alg_test+0x2a4/0x300
Code: 53 68 0b 27 9a c9 e8 e3 7f 3e 00 83 c4 10 89 f0 be fe ff ff ff 83 ff fe 74 9b 57 50 53 68 cd 80 9a c9 e8 37 a2 cb ff 83 c4 10 <0f> 0b 89 fe eb 85 68 ef 66 95 c9 53 56 68 ce 89 9b c9 e8 7d 7d 3e
EAX: 00000000 EBX: c1d2fa80 ECX: 00000000 EDX: 00000000
ESI: fffffffe EDI: ffffffff EBP: c1a4bf60 ESP: c1a4bec8
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010282
CR0: 80050033 CR2: 00000000 CR3: 09b7c000 CR4: 000006f0
Call Trace:
 ? show_regs+0x4e/0x5c
 ? __warn+0x87/0xdc
 ? alg_test+0x2a4/0x300
 ? report_bug+0x94/0x108
 ? exc_overflow+0x3c/0x3c
 ? handle_bug+0x41/0x60
 ? exc_invalid_op+0x17/0x40
 ? handle_exception+0x101/0x101
 ? exc_overflow+0x3c/0x3c
 ? alg_test+0x2a4/0x300
 ? exc_overflow+0x3c/0x3c
 ? alg_test+0x2a4/0x300
 ? __switch_to_asm+0x88/0xe4
 ? __switch_to_asm+0x82/0xe4
 ? __switch_to_asm+0x7c/0xe4
 ? __switch_to_asm+0x76/0xe4
 ? __switch_to_asm+0x70/0xe4
 ? __switch_to_asm+0x6a/0xe4
 ? __switch_to_asm+0x64/0xe4
 ? __switch_to_asm+0x5e/0xe4
 ? __switch_to_asm+0x58/0xe4
 ? __switch_to_asm+0x52/0xe4
 ? __switch_to_asm+0x4c/0xe4
 ? __switch_to_asm+0x46/0xe4
 ? _raw_spin_unlock+0x8/0xc
 ? finish_task_switch+0x98/0x244
 ? __switch_to_asm+0x1c/0xe4
 ? __switch_to_asm+0x16/0xe4
 ? __schedule+0x587/0x7a4
 cryptomgr_test+0x1c/0x38
Quoted 8 lines
 kthread+0xc4/0xd0
 ? crypto_alg_put+0x40/0x40
 ? kthread_blkcg+0x24/0x24
 ? kthread_blkcg+0x24/0x24
 ret_from_fork+0x31/0x3c
 ret_from_fork_asm+0x12/0x18
 entry_INT80_32+0xf0/0xf0
---[ end trace 0000000000000000 ]---

v6.12-rc3 still affected. So I bisected the issue to the following commit:

 # git bisect good
5a72a244bac3e8663834d88bb0b4f9069203e5e0 is the first bad commit
commit 5a72a244bac3e8663834d88bb0b4f9069203e5e0
Author: Herbert Xu <[email protected]>
Date:   Sat Aug 10 14:21:02 2024 +0800

crypto: rsa - Check MPI allocation errors

Fixes 6637e11e4ad2 ("crypto: rsa - allow only odd e and restrict value in FIPS mode")
Fixes f145d411a67e ("crypto: rsa - implement Chinese Remainder Theorem for faster private key operation")
 crypto/rsa.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Reverting 5a72a244bac3e8663834d88bb0b4f9069203e5e0 on top of v6.12-rc3 fixes the failure.

Regards,
Erhard

maintainer
#2 lore raw
Quoted 15 lines · Erhard Furtner

v6.12-rc3 still affected. So I bisected the issue to the following commit:

 # git bisect good
5a72a244bac3e8663834d88bb0b4f9069203e5e0 is the first bad commit
commit 5a72a244bac3e8663834d88bb0b4f9069203e5e0
Author: Herbert Xu <[email protected]>
Date:   Sat Aug 10 14:21:02 2024 +0800

crypto: rsa - Check MPI allocation errors

Fixes 6637e11e4ad2 ("crypto: rsa - allow only odd e and restrict value in FIPS mode")
Fixes f145d411a67e ("crypto: rsa - implement Chinese Remainder Theorem for faster private key operation")
Quoted 5 lines
 crypto/rsa.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Reverting 5a72a244bac3e8663834d88bb0b4f9069203e5e0 on top of v6.12-rc3 fixes the failure.

Thanks.

This patch should fix the problem and I'll push it into 6.12-rc.

commit 6100da511bd21d3ccb0a350c429579e8995a830e

Author: Qianqiang Liu <[email protected]>
Date:   Fri Sep 13 22:07:42 2024 +0800

crypto: lib/mpi - Fix an "Uninitialized scalar variable" issue

The "err" variable may be returned without an initialized value.

Fixes 8e3a67f2de87 ("crypto: lib/mpi - Add error checks to extension")
lib/crypto/mpi/mpi-mul.c +1 -1
index 892a246216b9..7e6ff1ce3e9b 100644
@@ -21,7 +21,7 @@ int mpi_mul(MPI w, MPI u, MPI v)
 	int usign, vsign, sign_product;
 	int assign_wp = 0;
 	mpi_ptr_t tmp_limb = NULL;
-	int err;
+	int err = 0;
 
 	if (u->nlimbs < v->nlimbs) {
 		/* Swap U and V. */
Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#3 lore raw
Quoted 20 lines · On Wed, 16 Oct 2024 13:36:12 +0800 Herbert Xu <[email protected]>…

This patch should fix the problem and I'll push it into 6.12-rc.

commit 6100da511bd21d3ccb0a350c429579e8995a830e

Author: Qianqiang Liu <[email protected]>
Date:   Fri Sep 13 22:07:42 2024 +0800

crypto: lib/mpi - Fix an "Uninitialized scalar variable" issue

The "err" variable may be returned without an initialized value.

Fixes 8e3a67f2de87 ("crypto: lib/mpi - Add error checks to extension")
lib/crypto/mpi/mpi-mul.c +0 -0
index 892a246216b9..7e6ff1ce3e9b 100644

lib/crypto/mpi/mpi-mul.c int mpi_mul(MPI w, MPI u, MPI v) · line 27

Quoted 8 lines
lib/crypto/mpi/mpi-mul.c +1 -1
@@ -21,7 +21,7 @@ int mpi_mul(MPI w, MPI u, MPI v)
 	int usign, vsign, sign_product;
 	int assign_wp = 0;
 	mpi_ptr_t tmp_limb = NULL;
-	int err;
+	int err = 0;
 
 	if (u->nlimbs < v->nlimbs) {
 		/* Swap U and V. */

I can confirm your patch fixes the issue. Thanks!

Regards,
Erhard