Thread (12 messages) 12 messages, 2 authors, 2021-05-21

Re: [PATCH v4 2/7] crypto: aead - disallow en/decrypt for non-task or non-softirq context

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2021-05-19 11:36:51
Also in: linux-crypto

On Wed, 19 May 2021 at 13:29, Herbert Xu [off-list ref] wrote:
On Wed, May 19, 2021 at 01:22:34PM +0200, Ard Biesheuvel wrote:
quoted
      crypto_stats_get(alg);
-     if (crypto_aead_get_flags(aead) & CRYPTO_TFM_NEED_KEY)
+     if (!(alg->cra_flags & CRYPTO_ALG_ASYNC) &&
+         WARN_ONCE(!in_task() && !in_serving_softirq(),
+                   "synchronous call from invalid context\n"))
+             ret = -EBUSY;
I don't think we've ever supported crypto in hard IRQ contexts.
So this should be done regardless of ASYNC.
OK.
Then again, do we really need this since the assumption has
always been that the crypto API can only be invoked in user or
softirq context?
With this series applied, some of the arm64 accelerated s/w
implementations will no longer work correctly when this rule is
violated, and so it would be nice to have a sanity check somewhere.
And policing rules like these is best done in generic code, right?

So if we do need to check this, we should check it here. If we don't,
then we can drop these patches.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help