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-next>] [day] [month] [year] [list]
Date:	Mon, 10 Mar 2014 17:22:51 +0800
From:	"Lee, Chun-Yi" <joeyli.kernel@...il.com>
To:	Herbert Xu <herbert@...dor.apana.org.au>,
	"David S. Miller" <davem@...emloft.net>
Cc:	linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Lee, Chun-Yi" <jlee@...e.com>
Subject: [PATCH] crypto: avoid module request when lookup crypto larval of template

When allocate crypto algorithms, e.g. crypto_alloc_shash(), using
template model will run into the path that call module_request().
But there have no any module alias that match with the template name.

e.g.
Enable the module_request tracing event then run "modprobe tcrypt
mode=10" to test, it produces module_request event:
[...]
        modprobe-4965  [000] ....   123.504690: module_request: ecb(aes)
wait=1 call_site=crypto_larval_lookup
        modprobe-4965  [002] ....   123.506826: module_request:
ecb(aes)-all wait=1 call_site=crypto_larval_lookup
 cryptomgr_probe-4970  [003] ....   123.509007: module_request: ecb
wait=1 call_site=crypto_lookup_template

Here should not call module_request() for ecb(aes) because the template
name doesn't match with any driver's alias.

This patch add the name checking in crypto_larval_lookup() to
filter out the template before request kernel module.

Signed-off-by: Lee, Chun-Yi <jlee@...e.com>
---
 crypto/api.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/crypto/api.c b/crypto/api.c
index a2b39c5..9aac892 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -215,7 +215,7 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
 	type &= mask;
 
 	alg = crypto_alg_lookup(name, type, mask);
-	if (!alg) {
+	if (!alg && !strchr(name, '(')) {
 		request_module("%s", name);
 
 		if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
-- 
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ