On Fri, 22 Nov 2024 at 05:51, Zorro Lang <zlang@xxxxxxxxxx> wrote: > > Hi, > > I hit a kernel panic on aarch64 several times recently, when I tried to do a > fstests test. It's not related with fstests, due to I hit it when I boot the > latest mainline linux kernel (HEAD=fc39fb56917bb3cb53e99560ca3612a84456ada2). > > The console log looks like related with crypto things, I'm not familar with > it, so just send this email to linux-crypto@ and cc linux-kernel@. > > I hit this panic several times, I did nothing except building and installing > the latest kernel and then boot it, then it crash directly on booting time. > Looks like crash from: > > 183 static inline void sg_set_buf(struct scatterlist *sg, const void *buf, > 184 unsigned int buflen) > 185 { > 186 #ifdef CONFIG_DEBUG_SG > ==> 187 BUG_ON(!virt_addr_valid(buf)); > 188 #endif > 189 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); > 190 } > > If someone need, I can provide the big linux/.config file. > Does this help? --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4300,12 +4300,14 @@ static int test_sig_one(struct crypto_sig *tfm, const struct sig_testvec *vecs) { + const u8 *src __free(kfree); u8 *ptr, *key __free(kfree); int err, sig_size; + src = kmemdup_nul(vecs->c, vecs->c_size, GFP_KERNEL); key = kmalloc(vecs->key_len + 2 * sizeof(u32) + vecs->param_len, GFP_KERNEL); - if (!key) + if (!src || !key) return -ENOMEM; /* ecrdsa expects additional parameters appended to the key */ @@ -4326,7 +4328,7 @@ * Run asymmetric signature verification first * (which does not require a private key) */ - err = crypto_sig_verify(tfm, vecs->c, vecs->c_size, + err = crypto_sig_verify(tfm, src, vecs->c_size, vecs->m, vecs->m_size); if (err) { pr_err("alg: sig: verify test failed: err %d\n", err);