diff mbox series

crypto: algboss - Pass instance creation error up

Message ID ZtQgoIhvZUvpI8K4@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: algboss - Pass instance creation error up | expand

Commit Message

Herbert Xu Sept. 1, 2024, 8:06 a.m. UTC
Pass any errors we get during instance creation up through the
larval.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Comments

kernel test robot Sept. 3, 2024, 8:40 a.m. UTC | #1
Hello,

kernel test robot noticed "ltp.cve-2017-17806.fail" on:

commit: 577bf9f41d619f74d0498abb0d9467d1bbc4e115 ("[PATCH] crypto: algboss - Pass instance creation error up")
url: https://github.com/intel-lab-lkp/linux/commits/Herbert-Xu/crypto-algboss-Pass-instance-creation-error-up/20240901-160826
base: https://git.kernel.org/cgit/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link: https://lore.kernel.org/all/ZtQgoIhvZUvpI8K4@gondor.apana.org.au/
patch subject: [PATCH] crypto: algboss - Pass instance creation error up

in testcase: ltp
version: ltp-x86_64-14c1f76-1_20240831
with following parameters:

	test: cve-07/cve-2017-17806



compiler: gcc-12
test machine: 8 threads 1 sockets Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz (Ivy Bridge) with 16G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)



If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202409031626.c7cf85de-oliver.sang@intel.com


Running tests.......
<<<test_start>>>
tag=cve-2017-17806 stime=1725329707
cmdline="af_alg01"
contacts=""
analysis=exit
<<<test_output>>>
tst_test.c:1809: TINFO: LTP version: 20240524-209-g9a6f3896f
tst_test.c:1813: TINFO: Tested kernel: 6.11.0-rc1-00074-g577bf9f41d61 #1 SMP PREEMPT_DYNAMIC Tue Sep  3 00:19:02 CST 2024 x86_64
tst_test.c:1652: TINFO: Timeout per run is 0h 00m 30s
af_alg01.c:36: TFAIL: instantiated nested hmac algorithm ('hmac(hmac(md5))')!
tst_af_alg.c:46: TBROK: unexpected error binding AF_ALG socket to hash algorithm 'hmac(hmac(md5))': EINVAL (22)

HINT: You _MAY_ be missing kernel fixes:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=af3ff8045bbf

HINT: You _MAY_ be vulnerable to CVE(s):

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17806

HINT: You _MAY_ be missing kernel fixes:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=af3ff8045bbf

HINT: You _MAY_ be vulnerable to CVE(s):

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17806

Summary:
passed   0
failed   1
broken   1
skipped  0
warnings 0
incrementing stop
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=3 corefile=no
cutime=0 cstime=1
<<<test_end>>>
INFO: ltp-pan reported some tests FAIL
LTP Version: 20240524-209-g9a6f3896f

       ###############################################################

            Done executing testcases.
            LTP Version:  20240524-209-g9a6f3896f
       ###############################################################



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240903/202409031626.c7cf85de-oliver.sang@intel.com
Herbert Xu Sept. 3, 2024, 9:54 a.m. UTC | #2
On Tue, Sep 03, 2024 at 04:40:33PM +0800, kernel test robot wrote:
>
> Running tests.......
> <<<test_start>>>
> tag=cve-2017-17806 stime=1725329707
> cmdline="af_alg01"
> contacts=""
> analysis=exit
> <<<test_output>>>
> tst_test.c:1809: TINFO: LTP version: 20240524-209-g9a6f3896f
> tst_test.c:1813: TINFO: Tested kernel: 6.11.0-rc1-00074-g577bf9f41d61 #1 SMP PREEMPT_DYNAMIC Tue Sep  3 00:19:02 CST 2024 x86_64
> tst_test.c:1652: TINFO: Timeout per run is 0h 00m 30s
> af_alg01.c:36: TFAIL: instantiated nested hmac algorithm ('hmac(hmac(md5))')!
> tst_af_alg.c:46: TBROK: unexpected error binding AF_ALG socket to hash algorithm 'hmac(hmac(md5))': EINVAL (22)

This is actually expected.  Previously the construction error
was discarded so user-space always ended up with ENOENT.  Now
the actual error is returned to user-space.

I recommend that this ltp test be modified accordingly.

Thanks,
diff mbox series

Patch

diff --git a/crypto/algboss.c b/crypto/algboss.c
index d05a5aad2176..a20926bfd34e 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -51,7 +51,7 @@  static int cryptomgr_probe(void *data)
 {
 	struct cryptomgr_param *param = data;
 	struct crypto_template *tmpl;
-	int err;
+	int err = -ENOENT;
 
 	tmpl = crypto_lookup_template(param->template);
 	if (!tmpl)
@@ -64,6 +64,7 @@  static int cryptomgr_probe(void *data)
 	crypto_tmpl_put(tmpl);
 
 out:
+	param->larval->adult = ERR_PTR(err);
 	param->larval->alg.cra_flags |= CRYPTO_ALG_DEAD;
 	complete_all(&param->larval->completion);
 	crypto_alg_put(&param->larval->alg);