Use of Crypto in kernel causes crash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use of Crypto in kernel causes crash

1,105 Views
sareenakp
Contributor II

Hi,

I am using T4240RDB with SDK linux version 3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b.

I am trying to use encryption functions in the ip forwarding path.

On an x86 system, the functions are working fine.

But on T4240RDB , I see the following crash.

Kindly advice the next step forward in getting this done.

Code

tfm = crypto_alloc_cipher("aes", 4, CRYPTO_ALG_ASYNC);
crypto_cipher_setkey(tfm, pkey, 16);
crypto_cipher_encrypt_one(tfm, dest, src);

The same is seen when I use AES in CBC mode (Be it in software or offloading to security engine)

Crash Dump:

BUG: scheduling while atomic: swapper/11/0/0x00000500

Modules linked in: qoriq_dbg(O)

CPU: 11 PID: 0 Comm: swapper/11 Tainted: G           O 3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b #106

Call Trace:

[c00000017ff56400] [c000000000008bb0] .show_stack+0x7c/0x1cc (unreliable)

[c00000017ff564d0] [c000000000742e68] .dump_stack+0x84/0xb0

[c00000017ff56550] [c000000000740df8] .__schedule_bug+0x50/0x74

[c00000017ff565c0] [c00000000073caac] .__schedule+0x494/0x544

[c00000017ff56810] [c00000000073cb8c] .schedule+0x30/0xb8

[c00000017ff56890] [c00000000073b47c] .schedule_timeout+0x154/0x244

[c00000017ff56970] [c00000000073d120] .io_schedule_timeout+0x74/0xb8

[c00000017ff56a00] [c0000000000dac1c] .congestion_wait+0x98/0xf8

[c00000017ff56ac0] [c0000000000d0688] .shrink_inactive_list+0x508/0x554

[c00000017ff56be0] [c0000000000d0eb0] .shrink_lruvec+0x3a8/0x698

[c00000017ff56d30] [c0000000000d11e8] .shrink_zone+0x48/0x160

[c00000017ff56dd0] [c0000000000d1528] .try_to_free_pages+0x228/0x584

[c00000017ff56f40] [c0000000000c6c4c] .__alloc_pages_nodemask+0x5b4/0x8b4

[c00000017ff570f0] [c000000000106a68] .cache_alloc_refill+0x4c0/0x8d4

[c00000017ff571d0] [c000000000106fb0] .__kmalloc+0x134/0x17c

[c00000017ff57270] [c000000000253dd8] .__crypto_alloc_tfm+0x148/0x214

[c00000017ff57300] [c000000000253f00] .crypto_alloc_base+0x5c/0xc8

[c00000017ff573a0] [c00000000069e590] .gre_build_header+0x140/0x208

[c00000017ff57450] [c00000000069f6a0] .__gre_xmit+0xf0/0x134

[c00000017ff574f0] [c00000000069f7a0] .ipgre_xmit+0xbc/0x208

[c00000017ff57580] [c000000000618484] .dev_hard_start_xmit+0x350/0x548

[c00000017ff57640] [c0000000006189bc] .dev_queue_xmit+0x340/0x530

[c00000017ff576e0] [c00000000062142c] .neigh_direct_output+0x14/0x28

[c00000017ff57750] [c000000000649f94] .ip_finish_output+0x24c/0x4c0

[c00000017ff57800] [c0000000006475e4] .ip_forward+0x40c/0x5f8

[c00000017ff578a0] [c000000000645b3c] .ip_rcv+0x300/0x568

[c00000017ff57950] [c000000000613960] .__netif_receive_skb_core+0x580/0x6ec

[c00000017ff57a30] [c0000000006159f0] .netif_receive_skb+0x3c/0xd8

[c00000017ff57ad0] [c0000000004a58d0] ._dpa_rx+0x1c4/0x758

[c00000017ff57bf0] [c0000000004a3d80] .priv_rx_default_dqrr+0xa8/0x188

[c00000017ff57ca0] [c0000000005c2bb4] .qman_p_poll_dqrr+0x1ac/0x28c

[c00000017ff57d60] [c0000000004a3e8c] .dpaa_eth_poll+0x2c/0x78

[c00000017ff57df0] [c000000000615ea0] .net_rx_action+0x164/0x260

[c00000017ff57ea0] [c00000000003f69c] .__do_softirq+0x15c/0x288

[c00000017ff57f90] [c000000000014c70] .call_do_softirq+0x14/0x24

[c00000017ff53e00] [c000000000005eac] .do_softirq+0xd0/0xfc

[c00000017ff53e90] [c00000000003ffc8] .irq_exit+0xb8/0xec

[c00000017ff53f10] [c000000000005ac0] .__do_irq+0x98/0xd0

[c00000017ff53f90] [c000000000014c94] .call_do_irq+0x14/0x24

[c0000001791cf9e0] [c000000000005b84] .do_IRQ+0x8c/0xfc

[c0000001791cfa80] [c00000000001893c] exc_0x500_common+0xfc/0x100

--- Exception: 501 at .book3e_idle+0x24/0x4c

    LR = .book3e_idle+0x24/0x4c

[c0000001791cfd70] [c00000000000a8ac] .arch_cpu_idle+0x34/0xa0 (unreliable)

[c0000001791cfde0] [c000000000081898] .cpu_startup_entry+0x17c/0x1e0

[c0000001791cfea0] [c00000000001f6b0] .start_secondary+0x42c/0x584

[c0000001791cff90] [c00000000000036c] .start_secondary_prolog+0x10/0x14

bad: scheduling from the idle thread!

CPU: 11 PID: 0 Comm: swapper/11 Tainted: G        W  O 3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b #106

Call Trace:

[c00000017ff56360] [c000000000008bb0] .show_stack+0x7c/0x1cc (unreliable)

[c00000017ff56430] [c000000000742e68] .dump_stack+0x84/0xb0

[c00000017ff564b0] [c000000000071714] .dequeue_task_idle+0x4c/0x80

[c00000017ff56530] [c00000000006a7c4] .dequeue_task+0x40/0xa4

[c00000017ff565c0] [c00000000073c740] .__schedule+0x128/0x544

[c00000017ff56810] [c00000000073cb8c] .schedule+0x30/0xb8

[c00000017ff56890] [c00000000073b47c] .schedule_timeout+0x154/0x244

[c00000017ff56970] [c00000000073d120] .io_schedule_timeout+0x74/0xb8

[c00000017ff56a00] [c0000000000dac1c] .congestion_wait+0x98/0xf8

[c00000017ff56ac0] [c0000000000d0688] .shrink_inactive_list+0x508/0x554

[c00000017ff56be0] [c0000000000d0eb0] .shrink_lruvec+0x3a8/0x698

[c00000017ff56d30] [c0000000000d11e8] .shrink_zone+0x48/0x160

[c00000017ff56dd0] [c0000000000d1528] .try_to_free_pages+0x228/0x584

[c00000017ff56f40] [c0000000000c6c4c] .__alloc_pages_nodemask+0x5b4/0x8b4

[c00000017ff570f0] [c000000000106a68] .cache_alloc_refill+0x4c0/0x8d4

[c00000017ff571d0] [c000000000106fb0] .__kmalloc+0x134/0x17c

[c00000017ff57270] [c000000000253dd8] .__crypto_alloc_tfm+0x148/0x214

[c00000017ff57300] [c000000000253f00] .crypto_alloc_base+0x5c/0xc8

[c00000017ff573a0] [c00000000069e590] .gre_build_header+0x140/0x208

[c00000017ff57450] [c00000000069f6a0] .__gre_xmit+0xf0/0x134

[c00000017ff574f0] [c00000000069f7a0] .ipgre_xmit+0xbc/0x208

[c00000017ff57580] [c000000000618484] .dev_hard_start_xmit+0x350/0x548

[c00000017ff57640] [c0000000006189bc] .dev_queue_xmit+0x340/0x530

[c00000017ff576e0] [c00000000062142c] .neigh_direct_output+0x14/0x28

[c00000017ff57750] [c000000000649f94] .ip_finish_output+0x24c/0x4c0

[c00000017ff57800] [c0000000006475e4] .ip_forward+0x40c/0x5f8

[c00000017ff578a0] [c000000000645b3c] .ip_rcv+0x300/0x568

[c00000017ff57950] [c000000000613960] .__netif_receive_skb_core+0x580/0x6ec

[c00000017ff57a30] [c0000000006159f0] .netif_receive_skb+0x3c/0xd8

[c00000017ff57ad0] [c0000000004a58d0] ._dpa_rx+0x1c4/0x758

[c00000017ff57bf0] [c0000000004a3d80] .priv_rx_default_dqrr+0xa8/0x188

[c00000017ff57ca0] [c0000000005c2bb4] .qman_p_poll_dqrr+0x1ac/0x28c

[c00000017ff57d60] [c0000000004a3e8c] .dpaa_eth_poll+0x2c/0x78

[c00000017ff57df0] [c000000000615ea0] .net_rx_action+0x164/0x260

[c00000017ff57ea0] [c00000000003f69c] .__do_softirq+0x15c/0x288

[c00000017ff57f90] [c000000000014c70] .call_do_softirq+0x14/0x24

[c00000017ff53e00] [c000000000005eac] .do_softirq+0xd0/0xfc

[c00000017ff53e90] [c00000000003ffc8] .irq_exit+0xb8/0xec

[c00000017ff53f10] [c000000000005ac0] .__do_irq+0x98/0xd0

[c00000017ff53f90] [c000000000014c94] .call_do_irq+0x14/0x24

[c0000001791cf9e0] [c000000000005b84] .do_IRQ+0x8c/0xfc

[c0000001791cfa80] [c00000000001893c] exc_0x500_common+0xfc/0x100

--- Exception: 501 at .book3e_idle+0x24/0x4c

    LR = .book3e_idle+0x24/0x4c

[c0000001791cfd70] [c00000000000a8ac] .arch_cpu_idle+0x34/0xa0 (unreliable)

[c0000001791cfde0] [c000000000081898] .cpu_startup_entry+0x17c/0x1e0

[c0000001791cfea0] [c00000000001f6b0] .start_secondary+0x42c/0x584

[c0000001791cff90] [c00000000000036c] .start_secondary_prolog+0x10/0x14

Unable to handle kernel paging request for data at address 0x00000000

Faulting instruction address: 0xc00000000006a758

Oops: Kernel access of bad area, sig: 11 [#1]

SMP NR_CPUS=24 CoreNet Generic

Modules linked in: qoriq_dbg(O)

CPU: 11 PID: 61 Comm: rcuc/11 Tainted: G        W  O 3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b #106

task: c000000179396200 ti: c00000017ff54000 task.ti: c0000001793cc000

NIP: c00000000006a758 LR: c00000000006a744 CTR: c000000000071620

REGS: c00000017ff57850 TRAP: 0300   Tainted: G        W  O  (3.12.19-rt30-QorIQ-SDK-V1.7+g6619b8b)

MSR: 0000000080029000 <CE,EE,ME>  CR: 84a24e44  XER: 00000000

SOFTE: 0

DEAR: 0000000000000000, ESR: 0000000000000100

GPR00: c00000000006a744 c00000017ff57ad0 c000000000b72f98 c0000000095b2fc0

GPR04: c0000001791ba1c0 0000000000000005 000000000004f84a c000000000b82f98

GPR08: 0000000000000005 0000000000000000 00000039c5ef1ac0 00000000000014fc

GPR12: 0000000024a24e44 c00000000fff9280 000000000000000a c00000007d0e9950

GPR16: 0000000000000600 0000000000000600 0000000004208040 c0000001793e9c28

GPR20: c0000001793e9828 0000000000000000 c0000001793e9428 c0000001793e9028

GPR24: 0000000000000058 0000000008b58000 0000000000000001 c000000000b7bbe0

GPR28: c000000000a5afc0 c0000000095b2fc0 c0000000095b2fc0 c0000000095b2fc0

NIP [c00000000006a758] .enqueue_task+0x78/0xa4

LR [c00000000006a744] .enqueue_task+0x64/0xa4

Call Trace:

[c00000017ff57ad0] [c00000000006a744] .enqueue_task+0x64/0xa4 (unreliable)

[c00000017ff57b60] [c00000000006c2ac] .ttwu_do_activate.constprop.68+0x44/0x70

[c00000017ff57be0] [c00000000006e314] .try_to_wake_up+0x264/0x3ec

[c00000017ff57cb0] [c000000000046a7c] .process_timeout+0x10/0x24

[c00000017ff57d20] [c0000000000476ac] .call_timer_fn.isra.30+0x44/0xb8

[c00000017ff57db0] [c000000000047940] .run_timer_softirq+0x220/0x2c8

[c00000017ff57ea0] [c00000000003f69c] .__do_softirq+0x15c/0x288

[c00000017ff57f90] [c000000000014c70] .call_do_softirq+0x14/0x24

[c0000001793cfa60] [c000000000005eac] .do_softirq+0xd0/0xfc

[c0000001793cfaf0] [c00000000003f040] .local_bh_enable+0xa4/0xac

[c0000001793cfb70] [c0000000000ac9fc] .rcu_cpu_kthread+0x410/0x654

[c0000001793cfc90] [c00000000006819c] .smpboot_thread_fn+0x208/0x260

[c0000001793cfd30] [c00000000005ddb8] .kthread+0xd4/0xdc

[c0000001793cfe30] [c000000000000888] .ret_from_kernel_thread+0x5c/0xd4

Instruction dump:

e8010010 ebe1fff8 7c0803a6 4e800020 f8810070 f8a10078 4bffff55 7fe3fb78

e8810070 e8a10078 e9240068 e9290008 <e9490000> f8410028 7d4903a6 e8490008

---[ end trace cff97c468ff6e1d1 ]---

Kernel panic - not syncing: Fatal exception in interrupt

Rebooting in 180 seconds..

Thanks and Regards,

Sareena.

Labels (1)
0 Kudos
1 Reply

553 Views
bpe
NXP Employee
NXP Employee

Are you making these calls from IRQ context or another kind of critical code? I doubt these functions are IRQ-safe.

Some discussion can be found here:

5.5. Spinlocks

c - How to solve "BUG: scheduling while atomic: swapper /0x00000103/0, CPU#0"? in TSC2007 Driver? - ...


Have a great day,

Platon

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos