lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZBE+QhPBxG7VhBry@gondor.apana.org.au>
Date:   Wed, 15 Mar 2023 11:40:50 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     meenakshi.aggarwal@....com
Cc:     horia.geanta@....com, V.sethi@....com, pankaj.gupta@....com,
        gaurav.jain@....com, davem@...emloft.net,
        linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: caam/jr - fix algorithms exit/cleanup

On Tue, Mar 14, 2023 at 11:37:33PM +0530, meenakshi.aggarwal@....com wrote:
> From: Horia GeantA <horia.geanta@....com>
> 
> Current implementations is not being able to gracefully unregister
> crypto algorithms from crypto API while there are users / allocated
> tfms (cra_refcnt > 1).
> 
> When unloading the caam_jr module, the .remove callback for the last JR
> device exits with -EBUSY and doesn't perform the clean-up
> (crypto algorithms unregistering etc.).
> 
> One side effect of this is leading to an oops, which occurs due to a
> corruption in the linked list of "misc devices"
> (drivers/char/misc.c - misc_list)
> 
> Signed-off-by: Horia GeantA <horia.geanta@....com>
> ---
>  drivers/crypto/caam/jr.c | 39 +++++++++++++++++++++++++++++++++------
>  1 file changed, 33 insertions(+), 6 deletions(-)

Sorry, I don't think this is the right way to go.

We need to disassociate the registration of the Crypto algorithms
(soft) from the presence of the hardware (hard).

Sure, you can certainly refuse to register any algorithms until
the first piece of hardware shows up.  But once you are registered,
you must not unregister yourself from the Crypto API until the module
actually goes away (when built-in that means never).

The complexity then goes into making sure that your driver fails
gracefully when the device goes away in the *middle* of a crypto
computation.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ