Trying to create a geli provider with "-e NULL" instapanics on head at r362978. I'm guessing the panic was introduced by r359374. Sadly, geli's test suite does not cover that algorithm. I can't reproduce the panic on stable/12 at r361403. Steps to Reproduce: # sudo mdconfig -a -t malloc -s 4m md0 # sudo geli onetime -e NULL md0 panic: IV_SEPARATE set when IV isn't used cpuid = 0 time = 1594654462 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe006013ba20 vpanic() at vpanic+0x182/frame 0xfffffe006013ba70 panic() at panic+0x43/frame 0xfffffe006013bad0 crypto_dispatch() at crypto_dispatch+0x682/frame 0xfffffe006013bb00 g_eli_crypto_run() at g_eli_crypto_run+0x1a6/frame 0xfffffe006013bb50 g_eli_worker() at g_eli_worker+0x368/frame 0xfffffe006013bbb0 fork_exit() at fork_exit+0x80/frame 0xfffffe006013bbf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe006013bbf0
jhb, could you please take a look at this? I think it's pretty likely that the bug was introduced by r359374.
A NULL mode should not exist anyway.
Hmm, I could either relax the assertion or we'd have to omit the flag for NULL. Arguably things that want to use a NULL transform should just not create an OCF session at all but instead handle it directly. IPsec mandates a NULL cipher for testing (but only for testing.) Presumably NULL doesn't need to use keys either. Hmm, try this: Index: geom/eli/g_eli_integrity.c =================================================================== --- geom/eli/g_eli_integrity.c (revision 361855) +++ geom/eli/g_eli_integrity.c (working copy) @@ -536,13 +536,15 @@ crp->crp_digest_start = 0; crp->crp_payload_start = sc->sc_alen; crp->crp_payload_length = data_secsize; - crp->crp_flags |= CRYPTO_F_IV_SEPARATE; if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) == 0) { crp->crp_cipher_key = g_eli_key_hold(sc, dstoff, encr_secsize); } - g_eli_crypto_ivgen(sc, dstoff, crp->crp_iv, - sizeof(crp->crp_iv)); + if (g_eli_ivlen(sc->sc_ealgo) != 0) { + crp->crp_flags |= CRYPTO_F_IV_SEPARATE; + g_eli_crypto_ivgen(sc, dstoff, crp->crp_iv, + sizeof(crp->crp_iv)); + } g_eli_auth_keygen(sc, dstoff, authkey); crp->crp_auth_key = authkey; Index: geom/eli/g_eli_privacy.c =================================================================== --- geom/eli/g_eli_privacy.c (revision 361855) +++ geom/eli/g_eli_privacy.c (working copy) @@ -281,13 +281,15 @@ crp->crp_payload_start = 0; crp->crp_payload_length = secsize; - crp->crp_flags |= CRYPTO_F_IV_SEPARATE; if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) == 0) { crp->crp_cipher_key = g_eli_key_hold(sc, dstoff, secsize); } - g_eli_crypto_ivgen(sc, dstoff, crp->crp_iv, - sizeof(crp->crp_iv)); + if (g_eli_ivlen(sc->sc_ealgo) != 0) { + crp->crp_flags |= CRYPTO_F_IV_SEPARATE; + g_eli_crypto_ivgen(sc, dstoff, crp->crp_iv, + sizeof(crp->crp_iv)); + } error = crypto_dispatch(crp); KASSERT(error == 0, ("crypto_dispatch() failed (error=%d)",
Created attachment 216613 [details] Fix geli's null cipher, and add a test case Your fix works for me, jhb. I've combined it with a regression test in the attached patch.
Comment on attachment 216613 [details] Fix geli's null cipher, and add a test case Looks good to me.
A commit references this bug: Author: asomers Date: Tue Jul 21 19:18:30 UTC 2020 New revision: 363402 URL: https://svnweb.freebsd.org/changeset/base/363402 Log: Fix geli's null cipher, and add a test case PR: 247954 Submitted by: jhb (sys), asomers (tests) Reviewed by: jhb (tests), asomers (sys) MFC after: 2 weeks Sponsored by: Axcient Changes: head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_privacy.c head/tests/sys/geom/class/eli/onetime_test.sh
A commit references this bug: Author: lwhsu Date: Wed Jul 22 17:37:11 UTC 2020 New revision: 363423 URL: https://svnweb.freebsd.org/changeset/base/363423 Log: Fix sys.geom.class.eli.onetime_test.onetime after r363402 PR: 247954 X-MFC with: r363402 Sponsored by: The FreeBSD Foundation Changes: head/tests/sys/geom/class/eli/onetime_test.sh
No need to MFC. Bug does not exist on stable/12.