Subject: linux-next: boot failure after merge of the crypto tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 27 Jun 2023 17:02:34 +1000

Hi all,

After merging the crypto tree, today's linux-next qemu boot test
(powerpc pseries_le_defconfig) failed like this:

 Loading compiled-in X.509 certificates
 BUG: Kernel NULL pointer dereference at 0x00000018
 Faulting instruction address: 0xc00000000092a054
 Oops: Kernel access of bad area, sig: 11 [#1]
 LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
 Modules linked in:
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.4.0-12597-g59adf7c9b6b4 #1
 Hardware name: IBM pSeries (emulated by qemu) POWER8 (raw) 0x4d0200 0xf000004 of:SLOF,HEAD pSeries
 NIP:  c00000000092a054 LR: c000000000929fdc CTR: 0000000000000000
 REGS: c00000000478f450 TRAP: 0380   Not tainted  (6.4.0-12597-g59adf7c9b6b4)
 MSR:  8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 24002420  XER: 20000000
 CFAR: c0000000009b30c0 IRQMASK: 0 
 GPR00: c000000000929fdc c00000000478f6f0 c000000001568f00 c000000006819800 
 GPR04: 0000000000000000 0000000000000000 0000000000000000 0000000000010100 
 GPR08: 0000000000000000 0000000000000000 0000000000000002 bc0793dad8bdf255 
 GPR12: 2e12589b9abeba33 c000000002b00000 c0000000000111a8 0000000000000000 
 GPR16: 0000000000000000 0000000000000000 c0000000028d1280 c000000002808a88 
 GPR20: c000000004764900 0000000000000000 0000000000000001 000000001f030000 
 GPR24: 000000000000052c c000000002139b00 000000000000000e 0000000000000040 
 GPR28: 000000000000dac0 c00000000404db00 0000000000000200 000000000000a400 
 NIP [c00000000092a054] crypto_sig_verify+0x114/0x180
 LR [c000000000929fdc] crypto_sig_verify+0x9c/0x180
 Call Trace:
 [c00000000478f6f0] [c000000000929fdc] crypto_sig_verify+0x9c/0x180 (unreliable)
 [c00000000478f7e0] [c0000000009361c0] public_key_verify_signature+0x3c0/0x590
 [c00000000478f8c0] [c0000000009393f0] x509_check_for_self_signed+0xc0/0x1b0
 [c00000000478f8f0] [c000000000937618] x509_cert_parse+0x1c8/0x270
 [c00000000478f970] [c000000000938c48] x509_key_preparse+0x38/0x260
 [c00000000478f9c0] [c00000000093262c] asymmetric_key_preparse+0x8c/0xe0
 [c00000000478fa10] [c0000000008af11c] __key_create_or_update+0x3cc/0x770
 [c00000000478fb40] [c000000000938b30] x509_load_certificate_list+0xb0/0x190
 [c00000000478fbe0] [c00000000203dac0] load_system_certificate_list+0x4c/0x60
 [c00000000478fc40] [c000000000010bc0] do_one_initcall+0x80/0x320
 [c00000000478fd20] [c000000002004994] kernel_init_freeable+0x304/0x3ac
 [c00000000478fdf0] [c0000000000111d0] kernel_init+0x30/0x1a0
 [c00000000478fe50] [c00000000000debc] ret_from_kernel_user_thread+0x14/0x1c
 --- interrupt: 0 at 0x0
 NIP:  0000000000000000 LR: 0000000000000000 CTR: 0000000000000000
 REGS: c00000000478fe80 TRAP: 0000   Not tainted  (6.4.0-12597-g59adf7c9b6b4)
 MSR:  0000000000000000 <>  CR: 00000000  XER: 00000000
 CFAR: 0000000000000000 IRQMASK: 0 
 GPR00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR04: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR12: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR24: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 GPR28: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
 NIP [0000000000000000] 0x0
 LR [0000000000000000] 0x0
 --- interrupt: 0
 Code: 7d4a4378 f9410070 0b060000 579c043e 9361009c e9410090 e8610040 93810098 794a07a0 7d295378 f9210090 e9230020 <e9290018> e989ffc0 7d8903a6 4e800421 
 ---[ end trace 0000000000000000 ]---

Reverting the following commits made it boot fine again:

  3867caee497e ("crypto: sm2 - Provide sm2_compute_z_digest when sm2 is disabled")
  63ba4d67594a ("KEYS: asymmetric: Use new crypto interface without scatterlists")
  e5221fa6a355 ("KEYS: asymmetric: Move sm2 code into x509_public_key")

-- 
Cheers,
Stephen Rothwell