Thread (12 messages) 12 messages, 3 authors, 2018-09-13

Re: [PATCH v2 2/4] crypto: skcipher - Enforce non-ASYNC for on-stack requests

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2018-09-07 03:43:07
Also in: linux-arm-kernel, lkml

On Thu, Sep 06, 2018 at 03:58:52PM -0700, Kees Cook wrote:
quoted hunk ↗ jump to hunk
@@ -437,6 +442,12 @@ static inline struct crypto_skcipher *crypto_skcipher_reqtfm_check(
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
 
+	if (req->__onstack) {
+		if (WARN_ON(crypto_skcipher_alg(tfm)->base.cra_flags &
+				CRYPTO_ALG_ASYNC))
+			return ERR_PTR(-EINVAL);
+	}
Sorry but I don't like imposing a run-time check on everybody when
stack-based requests are the odd ones out.  If we're going to make
this a run-time check (I'd much prefer a compile-time check, but I
understand that this may involve too much churn), then please do it
for stack-based request users only.

Thanks,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help