linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Horia Geantă" <horia.geanta@nxp.com>,
	"Pankaj Gupta" <pankaj.gupta@nxp.com>,
	"Gaurav Jain" <gaurav.jain@nxp.com>,
	"Mathew McBride" <matt@traverse.com.au>,
	linux-crypto@vger.kernel.org
Subject: Re: Hitting BUG_ON in crypto_unregister_alg() on reboot with caamalg_qi2 driver
Date: Fri, 10 Mar 2023 14:37:57 +0100	[thread overview]
Message-ID: <87ilf8rakq.fsf@toke.dk> (raw)
In-Reply-To: <ZAqwTqw3lR+dnImO@gondor.apana.org.au>

Herbert Xu <herbert@gondor.apana.org.au> writes:

> On Thu, Mar 09, 2023 at 03:51:22PM +0100, Toke Høiland-Jørgensen wrote:
>> Hi folks
>> 
>> I'm hitting what appears to be a deliberate BUG_ON() in
>> crypto_unregister_alg() when rebooting my traverse ten64 device on a
>> 6.2.2 kernel (using the Arch linux-aarch64 build, which is basically an
>> upstream kernel).
>> 
>> Any idea what might be causing this? It does not appear on an older
>> (5.17, which is the newest kernel that works reliably, for unrelated
>> reasons).
>
> On the face of it this looks like a generic issue with drivers
> and the Crypto API.  Historically crypto modules weren't meant
> to be removed/unregistered until the last user has freed the tfm.
>
> Obviously with drivers that start unregistering the algorithms when
> the hardware goes away this paradigm breaks.  What should happen is
> that the driver continues to hold onto the crypto algorithm registration
> even when the hardware has gone away.
>
> Some work has to be done in the driver to actually make this safe
> (all the drivers I've looked at are broken in this way).

Hmm, okay; any idea why this started happening with the newer kernel
version? I don't see any changes to the driver that could have caused
this; so is it some core-kernel change that has changed the
order of driver removal on shutdown or something?

Also, absent of a fixed driver (which doesn't sound like it's a trivial
fix?), how do I prevent the system from crashing on shutdown? The
BUG_ON() seems a bit heavy-handed, could it be replaced with a WARN_ON?

-Toke


  reply	other threads:[~2023-03-10 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 14:51 Hitting BUG_ON in crypto_unregister_alg() on reboot with caamalg_qi2 driver Toke Høiland-Jørgensen
2023-03-10  4:21 ` Herbert Xu
2023-03-10 13:37   ` Toke Høiland-Jørgensen [this message]
2023-03-11  8:03     ` Herbert Xu
2023-03-11 16:21       ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilf8rakq.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=gaurav.jain@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=matt@traverse.com.au \
    --cc=pankaj.gupta@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).