Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1453796rwb; Fri, 19 Aug 2022 04:08:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4WJCe7azx4g71EWKUNDe2fREJn3TbM1H8+oMvH06f607Sr9bnzDWmgAXBRQTzQ0nQA+lXJ X-Received: by 2002:a17:907:7635:b0:73d:52c1:1e85 with SMTP id jy21-20020a170907763500b0073d52c11e85mr939251ejc.694.1660907286512; Fri, 19 Aug 2022 04:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660907286; cv=none; d=google.com; s=arc-20160816; b=kjasNJt/1Tv1iPS7cW02cejVWNSMsPb14VOgfAAUl4S4PC2xWSCAlsC7hgOq3o2x4n Vym1FmIY6w5/3/dAPVrc1e444/UyKnLfaRf2FdqdiFOea4khamPPbEMY2YzwvzORr+sm uynnAhQLd+8xGyLBeiI6XodhAaOq4G/73ZtZA15NR5ysWN2e+gtpGQ284p3RmhoP7gB3 1RxBKP89PhVGI4tt9PI0WXRQXi96wc4m5Q8B4CkvnWDDvy0RMH09t36namJ+uNuTJSZx AZyPcjWVd9+JU1kY4hmt5/RM8A1VyAuJ4ALjfv4ouifCqXZNH8Lak/OL7XgUQnMYQkOo wdhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=xTA8TAizmxjmSrnIU9DKNvQR+pfjwfh5+e0jOKa6t+c=; b=XMms7PAqelgg83Ux3fmV0AagrNscPW9p8bUYg+WS8DjaGqbid5OJwOhXI3cak0puUU WhIM/RmP5Gh6MAKmz5tcnB3gBmGPAeUIWrMB6mUPI+Pv1Sq1F90OBMqC45gqaeg+BTYu KmhMTTBmVRxtvR9fxjZjej2N4yPfsn7NgqbzxitFioPxU4FZDig9sDu7wtHIdx1Ku3kZ Dqi3tVrnDdY97GEChOYX/9DNF1Rvt9J9/sPuBnvtJX1Hqy9qpWZmgYLDU4LGqB1qsZ3r bSvGRTwF0Ay84qXIhaDscUPjv6Lp7vN4TouN0X/YVJQpI7+XqLWgBfCJREt/gQMwWpG2 ifGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a056402438300b0044605636faesi3570977edc.102.2022.08.19.04.07.40; Fri, 19 Aug 2022 04:08:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348674AbiHSLGa (ORCPT + 99 others); Fri, 19 Aug 2022 07:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348679AbiHSLGH (ORCPT ); Fri, 19 Aug 2022 07:06:07 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B506FBA57 for ; Fri, 19 Aug 2022 04:05:50 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oOzor-00Cpp8-Sg; Fri, 19 Aug 2022 21:05:42 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 19 Aug 2022 19:05:41 +0800 Date: Fri, 19 Aug 2022 19:05:41 +0800 From: Herbert Xu To: Robert Elliott Cc: ebiggers@google.com, tim.c.chen@linux.intel.com, davem@davemloft.net, linux-crypto@vger.kernel.org, toshi.kani@hpe.com, rwright@hpe.com, elliott@hpe.com Subject: Re: [PATCH] crypto: testmgr - don't generate WARN for missing modules Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220813231443.2706-1-elliott@hpe.com> X-Newsgroups: apana.lists.os.linux.cryptoapi X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Robert Elliott wrote: > This userspace command: > modprobe tcrypt > or > modprobe tcrypt mode=0 > > runs all the tcrypt test cases numbered <200 (i.e., all the > test cases calling tcrypt_test() and returning return values). > > Tests are sparsely numbered from 0 to 1000. For example: > modprobe tcrypt mode=12 > tests sha512, and > modprobe tcrypt mode=152 > tests rfc4543(gcm(aes))) - AES-GCM as GMAC > > The test manager generates WARNING crashdumps every time it attempts > a test using an algorithm that is not available (not built-in to the > kernel or available as a module): > > alg: skcipher: failed to allocate transform for ecb(arc4): -2 > ------------[ cut here ]----------- > alg: self-tests for ecb(arc4) (ecb(arc4)) failed (rc=-2) > WARNING: CPU: 9 PID: 4618 at crypto/testmgr.c:5777 > alg_test+0x30b/0x510 > [50 more lines....] > > ---[ end trace 0000000000000000 ]--- > > If the kernel is compiled with CRYPTO_USER_API_ENABLE_OBSOLETE > disabled (the default), then these algorithms are not compiled into > the kernel or made into modules and trigger WARNINGs: > arc4 tea xtea khazad anubis xeta seed > > Additionally, any other algorithms that are not enabled in .config > will generate WARNINGs. In RHEL 9.0, for example, the default > selection of algorithms leads to 16 WARNING dumps. > > One attempt to fix this was by modifying tcrypt_test() to check > crypto_has_alg() and immediately return 0 if crypto_has_alg() fails, > rather than proceed and return a non-zero error value that causes > the caller (alg_test() in crypto/testmgr.c) to invoke WARN(). > That knocks out too many algorithms, though; some combinations > like ctr(des3_ede) would work. > > Instead, change the condition on the WARN to ignore a return > value is ENOENT, which is the value returned when the algorithm > or combination of algorithms doesn't exist. Add a pr_warn to > communicate that information in case the WARN is skipped. > > This approach allows algorithm tests to work that are combinations, > not provided by one driver, like ctr(blowfish). > > Result - no more WARNINGs: > modprobe tcrypt > [ 115.541765] tcrypt: testing md5 > [ 115.556415] tcrypt: testing sha1 > [ 115.570463] tcrypt: testing ecb(des) > [ 115.585303] cryptomgr: alg: skcipher: failed to allocate transform for ecb(des): -2 > [ 115.593037] cryptomgr: alg: self-tests for ecb(des) using ecb(des) failed (rc=-2) > [ 115.593038] tcrypt: testing cbc(des) > [ 115.610641] cryptomgr: alg: skcipher: failed to allocate transform for cbc(des): -2 > [ 115.618359] cryptomgr: alg: self-tests for cbc(des) using cbc(des) failed (rc=-2) > ... > > Signed-off-by: Robert Elliott > --- > crypto/testmgr.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt