Re: crypto: BUG: spinlock recursion when doing iperf over ipsec with crypto hardware device

From: Herbert Xu
Date: Thu Jan 13 2022 - 23:23:38 EST


On Fri, Jan 14, 2022 at 03:14:38PM +1100, Herbert Xu wrote:
> On Tue, Jan 11, 2022 at 10:47:12AM +0100, Corentin Labbe wrote:
> >
> > [ 44.646050] [<c0100afc>] (__irq_svc) from [<c080b9d4>] (xfrm_replay_advance+0x11c/0x3dc)
> > [ 44.654143] [<c080b9d4>] (xfrm_replay_advance) from [<c0809388>] (xfrm_input+0x4d0/0x1304)
> > [ 44.662408] [<c0809388>] (xfrm_input) from [<c03a3d88>] (crypto_finalize_request+0x5c/0xc4)
> > [ 44.670766] [<c03a3d88>] (crypto_finalize_request) from [<c06a0888>] (sun8i_ce_cipher_run+0x34/0x3c)
> > [ 44.679900] [<c06a0888>] (sun8i_ce_cipher_run) from [<c03a4264>] (crypto_pump_work+0x1a8/0x330)
>
> So did sun8i_ce_cipher_run ensure that BH is disabled before
> invoking xfrm_input? If not then this explains the dead-lock.

The issue appears to be with crypto_engine. It needs to ensure
that completion functions are called with BH disabled, not IRQ
disabled and definitely not BH enabled.

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt