Bug 196085

Summary: Crypto functions are broken on 4.11 arm kernel
Product: Platform Specific/Hardware Reporter: Charizard (charizard92)
Component: ARMAssignee: linux-arm-kernel (linux-arm-kernel)
Status: NEW ---    
Severity: blocking CC: vmlinuz386
Priority: P1    
Hardware: ARM   
OS: Linux   
Kernel Version: 4.11 Subsystem:
Regression: No Bisected commit-id:

Description Charizard 2017-06-15 21:31:19 UTC
On my Banana Pi (Allwinner A20, kernel 4.11.5) and my Nanopineo (Allwinner A3, kernel 4.11.3), the board may freeze when programs which use crypto functions are launched. When the board don't freeze, it's impossible to kill the program which was just started.

Hostapd and openvpn are concerned by this issue. 

Bananapi's logs : 

[  134.321805] Unable to handle kernel NULL pointer dereference at virtual address 0000000c
[  134.330177] pgd = c0004000
[  134.333167] [0000000c] *pgd=00000000
[  134.336970] Internal error: Oops: 5 [#1] SMP THUMB2
[  134.342010] Modules linked in: aes_arm(+) ccm xt_nat xt_conntrack veth ir_xmp_decoder ir_mce_kbd_decoder ir_sharp_decoder ir_sanyo_decoder ir_sony_decoder ir_jvc_decoder ir_rc6_decoder ir_nec_decoder ir_rc5_decoder xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_tcpudp bridge stp llc iptable_filter ip_tables x_tables rt2800usb rt2800lib rt2x00usb rt2x00lib evdev sun4i_codec mac80211 snd_soc_core snd_pcm_dmaengine snd_pcm nvmem_sunxi_sid nvmem_core snd_timer snd soundcore ir_lirc_codec lirc_dev sunxi_cir sun4i_ss fuse cpufreq_dt uio_pdrv_genirq uio bonding brcmfmac brcmutil cfg80211 rfkill realtek
[  134.405095] CPU: 0 PID: 1974 Comm: cryptomgr_test Not tainted 4.11.5-sunxi #1
[  134.412434] Hardware name: Allwinner sun7i (A20) Family
[  134.417808] task: ef13ea40 task.stack: ec560000
[  134.422479] PC is at crypto_remove_spawns+0x7c/0x180
[  134.427584] LR is at 0xec561f18
[  134.430820] pc : [<c04d513c>]    lr : [<ec561f18>]    psr: a00d0133
               sp : ec561f10  ip : ec561f20  fp : ec561f50
[  134.442608] r10: 00000401  r9 : c0c74108  r8 : ecc30688
[  134.447981] r7 : 00000000  r6 : ec561f10  r5 : ec561f18  r4 : 00000000
[  134.454689] r3 : ecc31888  r2 : bfbf5000  r1 : ecc307c0  r0 : c0c74100
[  134.461411] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment none
[  134.468933] Control: 50c5387d  Table: 6c63806a  DAC: 00000051
[  134.474855] Process cryptomgr_test (pid: 1974, stack limit = 0xec560210)
[  134.481752] Stack: (0xec561f10 to 0xec562000)
[  134.486248] 1f00:                                     ee7dc9c0 ee7dc9c0 ecc319d8 ecc307c0
[  134.499289] 1f20: ec561f20 ec561f20 00000000 ecc20200 bfbf5000 c0c72e18 00000401 c0c74100
[  134.517233] 1f40: bfbf5028 bfbf5068 c0c74128 c04d5433 ec561f50 ec561f50 ec669640 edd6b300
[  134.535282] 1f60: ec669640 00000000 ec560000 edd6b300 c04d9e5d ec715d10 ec5e319c c04d9e6d
[  134.553678] 1f80: ec5e3180 c012ff49 ffffffff ec669640 c012fe4d 00000000 00000000 00000000
[  134.572384] 1fa0: 00000000 00000000 00000000 c0106351 00000000 00000000 00000000 00000000
[  134.591071] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  134.609729] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00180002 00004020
[  134.628386] [<c04d513c>] (crypto_remove_spawns) from [<c04d5433>] (crypto_alg_tested+0xfb/0x12c)
[  134.647670] [<c04d5433>] (crypto_alg_tested) from [<c04d9e6d>] (cryptomgr_test+0x11/0x20)
[  134.666368] [<c04d9e6d>] (cryptomgr_test) from [<c012ff49>] (kthread+0xfd/0x104)
[  134.684527] [<c012ff49>] (kthread) from [<c0106351>] (ret_from_fork+0x11/0x20)
[  134.697364] Code: 681c 42a3 d014 681c (68e3) 4283 
[  134.708311] ---[ end trace 34a6d32538f81975 ]---

Nanopineo's logs : 

[  127.197678] Unable to handle kernel NULL pointer dereference at virtual address 0000000c
[  127.206217] pgd = c0004000
[  127.209263] [0000000c] *pgd=00000000
[  127.212940] Internal error: Oops: 5 [#1] SMP THUMB2
[  127.217857] Modules linked in: aes_arm(+) ccm fuse xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_tcpudp iptable_filter ip_tables x_tables evdev rt2800usb rt2800lib rt2x00usb rt2x00lib mac80211 cfg80211 rfkill sun8i_codec_analog snd_soc_core snd_pcm_dmaengine snd_pcm sun8i_ths cpufreq_dt gpio_keys thermal_sys uio_pdrv_genirq uio g_serial libcomposite
[  127.257811] CPU: 0 PID: 1373 Comm: cryptomgr_test Not tainted 4.11.3-sun8i #7
[  127.264979] Hardware name: Allwinner sun8i Family
[  127.269721] task: db54d700 task.stack: d643a000
[  127.274311] PC is at crypto_remove_spawns+0x74/0x178
[  127.279309] LR is at 0xd643bf18
[  127.282490] pc : [<c042c67c>]    lr : [<d643bf18>]    psr: a00e0033
               sp : d643bf10  ip : d643bf20  fp : d643bf50
[  127.294018] r10: 00000401  r9 : c0b24448  r8 : db64a888
[  127.299278] r7 : 00000000  r6 : d643bf10  r5 : d643bf18  r4 : 00000000
[  127.305843] r3 : de3f6488  r2 : bfa8f000  r1 : db64a9c0  r0 : c0b24440
[  127.312410] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment none
[  127.319759] Control: 50c5387d  Table: 5643006a  DAC: 00000051
[  127.325540] Process cryptomgr_test (pid: 1373, stack limit = 0xd643a210)
[  127.332277] Stack: (0xd643bf10 to 0xd643c000)
[  127.336677] bf00:                                     dd336fc0 dd336fc0 de3f65d8 db64a9c0
[  127.344982] bf20: d643bf20 d643bf20 00000000 de371a00 bfa8f000 c0b23158 00000401 c0b24440
[  127.353280] bf40: bfa8f028 bfa8f068 c0b24468 c042c95d d643bf50 d643bf50 dd04f580 dd802180
[  127.361577] bf60: dd04f580 00000000 d643a000 dd802180 c0430dd9 d6439d10 d9a8a09c c0430de3
[  127.369872] bf80: d9a8a080 c012c639 ffffffff dd04f580 c012c545 00000000 00000000 00000000
[  127.378166] bfa0: 00000000 00000000 00000000 c01060f1 00000000 00000000 00000000 00000000
[  127.386459] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  127.394754] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 78656820 706d7564
[  127.403080] [<c042c67c>] (crypto_remove_spawns) from [<c042c95d>] (crypto_alg_tested+0xf5/0x124)
[  127.412002] [<c042c95d>] (crypto_alg_tested) from [<c0430de3>] (cryptomgr_test+0xb/0x18)
[  127.420226] [<c0430de3>] (cryptomgr_test) from [<c012c639>] (kthread+0xf5/0xfc)
[  127.427667] [<c012c639>] (kthread) from [<c01060f1>] (ret_from_fork+0x11/0x20)
[  127.435008] Code: 681c 42a3 d014 681c (68e3) 4283 
[  127.440193] ---[ end trace 2db9087c5091ab59 ]---
Comment 1 Gerardo Exequiel Pozzi 2017-08-12 23:23:05 UTC
I just restarted my machine (x86_64) and I get a similar BUG, but this was one time, not  able to reproduce, maybe some kind of race condition. Running 4.12.6. Never hit such things with 4.4.x, Same things running as you OpenVPN, hostapd, LUKS (/home).

ago 12 20:00:49.689187 kernel: BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
ago 12 20:00:49.689299 kernel: IP: crypto_remove_spawns+0xa3/0x240
ago 12 20:00:50.108700 kernel: PGD 11ae99067 
ago 12 20:00:50.342059 kernel: P4D 11ae99067 
ago 12 20:00:50.342126 kernel: PUD 11ae98067 
ago 12 20:00:50.342170 kernel: PMD 0 
ago 12 20:00:50.342213 kernel: 
ago 12 20:00:50.342261 kernel: Oops: 0000 [#1] PREEMPT SMP
ago 12 20:00:50.342305 kernel: Modules linked in: aes_x86_64(+) ccm xts algif_skcipher af_alg 8021q xt_TCPMSS ipt_REJECT nf_reject_ipv4 xt_pkttype nf_log_ipv4 nf_log_common xt_LOG xt_conntr
ago 12 20:00:50.342381 kernel:  sch_fq_codel vboxnetflt(O) vboxnetadp(O) vboxpci(O) vboxdrv(O) nfsd auth_rpcgss oid_registry lockd binfmt_misc grace sunrpc sg ip_tables x_tables ipv6 autofs
ago 12 20:00:50.342425 kernel: CPU: 1 PID: 537 Comm: cryptomgr_test Tainted: P           O    4.12.6 #1
ago 12 20:00:50.342468 kernel: Hardware name: System manufacturer System Product Name/M2N32-SLI DELUXE, BIOS ASUS M2N32-SLI DELUXE ACPI BIOS Revision 1603 12/17/2007
ago 12 20:00:50.365320 kernel: task: ffff880120446c00 task.stack: ffffc90000618000
ago 12 20:00:50.365368 kernel: RIP: 0010:crypto_remove_spawns+0xa3/0x240
ago 12 20:00:50.365407 kernel: RSP: 0018:ffffc9000061be40 EFLAGS: 00010286
ago 12 20:00:50.365450 kernel: RAX: ffff880120b94c60 RBX: ffffc9000061be40 RCX: 0000000000000000
ago 12 20:00:50.382370 kernel: RDX: ffffffffa16be000 RSI: ffffc9000061beb0 RDI: ffffffff81629c20
ago 12 20:00:50.382416 kernel: RBP: ffffc9000061be90 R08: ffff880120b95608 R09: ffffc9000061be50
ago 12 20:00:50.382455 kernel: R10: ffffc9000061be60 R11: ffff880120b95460 R12: ffffffff81629c30
ago 12 20:00:50.382494 kernel: R13: ffffffff81629c30 R14: 0000000000000401 R15: ffffffffa16be000
ago 12 20:00:50.382533 kernel: FS:  0000000000000000(0000) GS:ffff880127d00000(0000) knlGS:0000000000000000
ago 12 20:00:50.382577 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
ago 12 20:00:50.382612 kernel: CR2: 0000000000000018 CR3: 000000011d64b000 CR4: 00000000000006e0
ago 12 20:00:50.382650 kernel: Call Trace:
ago 12 20:00:50.382686 kernel:  crypto_alg_tested+0x169/0x1c0
ago 12 20:00:50.382727 kernel:  cryptomgr_test+0xf/0x20
ago 12 20:00:50.382766 kernel:  kthread+0x11b/0x140
ago 12 20:00:50.382822 kernel:  ? cryptomgr_notify+0x3c0/0x3c0
ago 12 20:00:50.382861 kernel:  ? kthread_create_on_node+0x40/0x40
ago 12 20:00:50.382901 kernel:  ret_from_fork+0x22/0x30
ago 12 20:00:50.382939 kernel: Code: 4d 89 43 08 4c 89 18 4c 89 50 08 4c 89 45 d0 49 89 c8 48 89 c8 48 8b 09 4d 39 e8 75 bf 4c 89 d0 48 8b 08 48 39 c8 74 4a 48 8b 08 <48> 8b 41 18 48 39 f8 
ago 12 20:00:50.382980 kernel: RIP: crypto_remove_spawns+0xa3/0x240 RSP: ffffc9000061be40
ago 12 20:00:50.383048 kernel: CR2: 0000000000000018
ago 12 20:00:50.383150 kernel: ---[ end trace 18ab574cbaa75641 ]---


and while rebooting after getting such BUG...

ago 12 20:03:28.228985 kernel: ------------[ cut here ]------------
ago 12 20:03:28.229069 kernel: WARNING: CPU: 1 PID: 528 at /usr/src/linux-4.12.6/crypto/algapi.c:348 crypto_wait_for_test+0x4d/0x60
ago 12 20:03:28.229135 kernel: Modules linked in: ctr(+) aes_x86_64(+) ccm xts algif_skcipher af_alg 8021q xt_TCPMSS ipt_REJECT nf_reject_ipv4 xt_pkttype nf_log_ipv4 nf_log_common xt_LOG xt
ago 12 20:03:28.229217 kernel:  processor sch_fq_codel vboxnetflt(O) vboxnetadp(O) vboxpci(O) vboxdrv(O) nfsd auth_rpcgss oid_registry lockd binfmt_misc grace sunrpc sg ip_tables x_tables i
ago 12 20:03:28.229303 kernel: CPU: 1 PID: 528 Comm: modprobe Tainted: P      D    O    4.12.6 #1
ago 12 20:03:28.229369 kernel: Hardware name: System manufacturer System Product Name/M2N32-SLI DELUXE, BIOS ASUS M2N32-SLI DELUXE ACPI BIOS Revision 1603 12/17/2007
ago 12 20:03:28.229448 kernel: task: ffff88011d8a3c00 task.stack: ffffc90000760000
ago 12 20:03:28.229541 kernel: RIP: 0010:crypto_wait_for_test+0x4d/0x60
ago 12 20:03:28.229618 kernel: RSP: 0018:ffffc90000763cd0 EFLAGS: 00010286
ago 12 20:03:28.229675 kernel: RAX: 00000000fffffe00 RBX: ffff8801219dfc00 RCX: 0000000000000080
ago 12 20:03:28.229744 kernel: RDX: 00000000fffffe00 RSI: 0000000000000000 RDI: ffff8801219dfdb0
ago 12 20:03:28.229831 kernel: RBP: ffffc90000763cd8 R08: 00000000000000ad R09: ffff88011d8a3c80
ago 12 20:03:28.229905 kernel: R10: 0000000000000000 R11: 0000000000000400 R12: 0000000000000000
ago 12 20:03:28.229979 kernel: R13: ffff8801225afbe0 R14: ffff8801225fe540 R15: ffffc90000763ec0
ago 12 20:03:28.230057 kernel: FS:  00007f4c885e8b40(0000) GS:ffff880127d00000(0000) knlGS:0000000000000000
ago 12 20:03:28.230112 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
ago 12 20:03:28.230194 kernel: CR2: 00007fdf32585ed8 CR3: 000000011d64b000 CR4: 00000000000006e0
ago 12 20:03:28.230271 kernel: Call Trace:
ago 12 20:03:28.230337 kernel:  crypto_register_alg+0x64/0x80
ago 12 20:03:28.230406 kernel:  ? 0xffffffffa0054000
ago 12 20:03:28.230470 kernel:  aes_init+0x10/0x1000 [aes_x86_64]
ago 12 20:03:28.230526 kernel:  do_one_initcall+0x45/0x160
ago 12 20:03:28.230600 kernel:  do_init_module+0x55/0x1d7
ago 12 20:03:28.230671 kernel:  load_module+0x1fe5/0x22e0
ago 12 20:03:28.230741 kernel:  ? find_symbol_in_section+0xc0/0xc0
ago 12 20:03:28.231307 kernel:  ? vfs_writev+0x21/0x40
ago 12 20:03:28.231405 kernel:  ? kernel_read_file_from_fd+0x4f/0x80
ago 12 20:03:28.231449 kernel:  SyS_finit_module+0xb9/0xd0
ago 12 20:03:28.231527 kernel:  entry_SYSCALL_64_fastpath+0x13/0x94
ago 12 20:03:28.231611 kernel: RIP: 0033:0x7f4c87d03029
ago 12 20:03:28.231691 kernel: RSP: 002b:00007ffd5891e318 EFLAGS: 00000206 ORIG_RAX: 0000000000000139
ago 12 20:03:28.231761 kernel: RAX: ffffffffffffffda RBX: 00007f4c88622100 RCX: 00007f4c87d03029
ago 12 20:03:28.231819 kernel: RDX: 0000000000000000 RSI: 000000000041aada RDI: 0000000000000000
ago 12 20:03:28.231865 kernel: RBP: 0000000000000000 R08: 0000000000000000 R09: 00000000025052b0
ago 12 20:03:28.231907 kernel: R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000001
ago 12 20:03:28.231950 kernel: R13: 0000000000000006 R14: 00007f4c885eb478 R15: 0000000000000000
ago 12 20:03:28.232003 kernel: Code: 75 2e 48 8d bb b8 00 00 00 31 f6 e8 0e fe ff ff 48 8d bb a8 01 00 00 e8 e2 32 1e 00 85 c0 75 0b 48 89 df e8 76 e8 ff ff 5b 5d c3 <0f> ff 90 eb f0 0f ff 
ago 12 20:03:28.232047 kernel: ---[ end trace 18ab574cbaa75642 ]---

if more info is needed please let me know.