[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_D1BC2F696F3495C4E80AEC1ECD7C79366C0A@qq.com>
Date: Wed, 20 Dec 2023 14:07:52 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+8ffb0839a24e9c6bfa76@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [crypto?] KASAN: slab-out-of-bounds Read in arc4_crypt
please test slab-out-of-bounds Read in arc4_crypt
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 17cb8a20bde6
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 02cea2149504..1c50f6e3f334 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -120,6 +120,10 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg,
if (IS_ERR(areq))
return PTR_ERR(areq);
+ printk("req: %p, areqlen: %u, %s\n",
+ &areq->cra_u.skcipher_req, areq->areqlen, __func__);
+ if (areq->areqlen < 1032)
+ areq->cra_u.skcipher_req->__ctx = kzalloc(1032, GFP_KERNEL);
/* convert iovecs of output buffers into RX SGL */
err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len);
if (err)
diff --git a/crypto/arc4.c b/crypto/arc4.c
index 1a4825c97c5a..79621f4f4c68 100644
--- a/crypto/arc4.c
+++ b/crypto/arc4.c
@@ -29,6 +29,7 @@ static int crypto_arc4_crypt(struct crypto_lskcipher *tfm, const u8 *src,
{
struct arc4_ctx *ctx = crypto_lskcipher_ctx(tfm);
+ printk("%p, flags: %u, ctx: %p, %s\n", siv, flags, ctx, __func__);
if (!(flags & CRYPTO_LSKCIPHER_FLAG_CONT))
memcpy(siv, ctx, sizeof(*ctx));
diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c
index a06008e112f3..4dda11ce6536 100644
--- a/crypto/lskcipher.c
+++ b/crypto/lskcipher.c
@@ -215,6 +215,10 @@ static int crypto_lskcipher_crypt_sg(struct skcipher_request *req,
flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP;
+ printk("r: %p, ivs: %p, v: %d, s: %u, ri: %p, wi: %p, f: %u, wnb: %u, am: %u, %s\n",
+ req, ivs, IS_ERR_OR_NULL(ivs), ivsize, req->iv, walk.iv,
+ req->base.flags, walk.nbytes, crypto_skcipher_alignmask(skcipher), __func__);
+
if (req->base.flags & CRYPTO_SKCIPHER_REQ_CONT)
flags |= CRYPTO_LSKCIPHER_FLAG_CONT;
else
@@ -224,6 +228,9 @@ static int crypto_lskcipher_crypt_sg(struct skcipher_request *req,
flags |= CRYPTO_LSKCIPHER_FLAG_FINAL;
err = skcipher_walk_virt(&walk, req, false);
+ printk("ivs: %p, v: %d, s: %u, ri: %p, wi: %p, f: %u, wnb: %u, %s\n",
+ ivs, IS_ERR_OR_NULL(ivs), ivsize, req->iv, walk.iv,
+ req->base.flags, walk.nbytes, __func__);
while (walk.nbytes) {
err = crypt(tfm, walk.src.virt.addr, walk.dst.virt.addr,
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index bc70e159d27d..08409990b58a 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -716,6 +716,8 @@ static int crypto_lskcipher_import(struct skcipher_request *req, const void *in)
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
u8 *ivs = skcipher_request_ctx(req);
+ printk("%p, csa: %u, csi: %u, tfm: %p, in: %p, %s\n",
+ ivs, crypto_skcipher_alignmask(tfm), crypto_skcipher_ivsize(tfm), tfm, in, __func__);
ivs = PTR_ALIGN(ivs, crypto_skcipher_alignmask(tfm) + 1);
memcpy(ivs + crypto_skcipher_ivsize(tfm), in,
Powered by blists - more mailing lists