Re: [syzbot] [crypto?] KMSAN: uninit-value in af_alg_free_resources

From: Pavel Skripkin
Date: Fri Jul 14 2023 - 10:57:14 EST


Hi Syzbot,

Syzbot <syzbot+cba21d50095623218389@xxxxxxxxxxxxxxxxxxxxxxxxx> says:
Hello,

syzbot found the following issue on:

HEAD commit: 3f01e9fed845 Merge tag 'linux-watchdog-6.5-rc2' of git://w..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=14bac16aa80000
kernel config: https://syzkaller.appspot.com/x/.config?x=1542573e31cfbec5
dashboard link: https://syzkaller.appspot.com/bug?extid=cba21d50095623218389
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15dd215aa80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14530318a80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4f212a7e36fe/disk-3f01e9fe.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/de6b12daf908/vmlinux-3f01e9fe.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2c1992ff2aaa/bzImage-3f01e9fe.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+cba21d50095623218389@xxxxxxxxxxxxxxxxxxxxxxxxx

#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master





With regards,
Pavel Skripkindiff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 06b15b9f661c..4e4f2d837481 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -1241,6 +1241,8 @@ int af_alg_get_rsgl(struct sock *sk, struct msghdr *msg, int flags,
return -ENOMEM;
}

+ rsgl->sgl.need_unpin = 0;
+
rsgl->sgl.sgt.sgl = rsgl->sgl.sgl;
rsgl->sgl.sgt.nents = 0;
rsgl->sgl.sgt.orig_nents = 0;