[syzbot] [kernel?] KMSAN: kernel-infoleak in do_insn_ioctl

7 views
Skip to first unread message

syzbot

unread,
Jul 17, 2025, 3:14:35 PM7/17/25
to abb...@mev.co.uk, hswe...@visionengravers.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e2291551827f Merge tag 'probes-fixes-v6.16-rc6' of git://g..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1220e7d4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=fdecd0cbf7c2893
dashboard link: https://syzkaller.appspot.com/bug?extid=a5e45f768aab5892da5d
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/45d0dd363fc0/disk-e2291551.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2ac861991e19/vmlinux-e2291551.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a6c77d2eaafd/bzImage-e2291551.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a5e45f...@syzkaller.appspotmail.com

=====================================================
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
BUG: KMSAN: kernel-infoleak in _inline_copy_to_user include/linux/uaccess.h:196 [inline]
BUG: KMSAN: kernel-infoleak in _copy_to_user+0xcc/0x120 lib/usercopy.c:26
instrument_copy_to_user include/linux/instrumented.h:114 [inline]
_inline_copy_to_user include/linux/uaccess.h:196 [inline]
_copy_to_user+0xcc/0x120 lib/usercopy.c:26
copy_to_user include/linux/uaccess.h:225 [inline]
do_insn_ioctl+0x516/0x630 drivers/comedi/comedi_fops.c:1641
comedi_unlocked_ioctl+0x13dd/0x1e00 drivers/comedi/comedi_fops.c:2263
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0x239/0x400 fs/ioctl.c:893
__x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:893
x64_sys_call+0x1ebe/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:17
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
slab_post_alloc_hook mm/slub.c:4154 [inline]
slab_alloc_node mm/slub.c:4197 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kmalloc_noprof+0x95f/0x1310 mm/slub.c:4340
kmalloc_noprof include/linux/slab.h:909 [inline]
kmalloc_array_noprof include/linux/slab.h:948 [inline]
do_insn_ioctl+0x108/0x630 drivers/comedi/comedi_fops.c:1623
comedi_unlocked_ioctl+0x13dd/0x1e00 drivers/comedi/comedi_fops.c:2263
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0x239/0x400 fs/ioctl.c:893
__x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:893
x64_sys_call+0x1ebe/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:17
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Bytes 4-583 of 584 are uninitialized
Memory access of size 584 starts at ffff88810355d000

CPU: 0 UID: 0 PID: 12350 Comm: syz.1.1721 Tainted: G W 6.16.0-rc6-syzkaller-00037-ge2291551827f #0 PREEMPT(none)
Tainted: [W]=WARN
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
=====================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Jul 21, 2025, 2:59:38 PM7/21/25
to abb...@mev.co.uk, hswe...@visionengravers.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 89be9a83ccf1 Linux 6.16-rc7
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=172b7722580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7753c32e11ff6a95
dashboard link: https://syzkaller.appspot.com/bug?extid=a5e45f768aab5892da5d
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13358fd4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=146fc4f0580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d81be8d18fda/disk-89be9a83.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/00dac9042245/vmlinux-89be9a83.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0d63e27252f4/bzImage-89be9a83.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a5e45f...@syzkaller.appspotmail.com

=====================================================
BUG: KMSAN: kernel-infoleak-after-free in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
BUG: KMSAN: kernel-infoleak-after-free in _inline_copy_to_user include/linux/uaccess.h:196 [inline]
BUG: KMSAN: kernel-infoleak-after-free in _copy_to_user+0xcc/0x120 lib/usercopy.c:26
instrument_copy_to_user include/linux/instrumented.h:114 [inline]
_inline_copy_to_user include/linux/uaccess.h:196 [inline]
_copy_to_user+0xcc/0x120 lib/usercopy.c:26
copy_to_user include/linux/uaccess.h:225 [inline]
do_insn_ioctl+0x59c/0x6d0 drivers/comedi/comedi_fops.c:1661
comedi_unlocked_ioctl+0x1432/0x1e80 drivers/comedi/comedi_fops.c:2286
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0x23c/0x400 fs/ioctl.c:893
__x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:893
x64_sys_call+0x1ebe/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:17
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
slab_free_hook mm/slub.c:2307 [inline]
slab_free mm/slub.c:4643 [inline]
kfree+0x252/0xec0 mm/slub.c:4842
put_css_set_locked+0xf5c/0x1440 kernel/cgroup/cgroup.c:971
cgroup_migrate_finish+0x1d0/0x7c0 kernel/cgroup/cgroup.c:2758
cgroup_attach_task+0x6ec/0x970 kernel/cgroup/cgroup.c:2957
__cgroup1_procs_write+0x4ba/0x670 kernel/cgroup/cgroup-v1.c:528
cgroup1_procs_write+0x44/0x60 kernel/cgroup/cgroup-v1.c:541
cgroup_file_write+0x38d/0x920 kernel/cgroup/cgroup.c:4183
kernfs_fop_write_iter+0x545/0x9e0 fs/kernfs/file.c:334
new_sync_write fs/read_write.c:593 [inline]
vfs_write+0xb4b/0x1580 fs/read_write.c:686
ksys_write fs/read_write.c:738 [inline]
__do_sys_write fs/read_write.c:749 [inline]
__se_sys_write fs/read_write.c:746 [inline]
__x64_sys_write+0x1fb/0x4d0 fs/read_write.c:746
x64_sys_call+0x38c3/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:2
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Bytes 4-59 of 60 are uninitialized
Memory access of size 60 starts at ffff88804acc6380
Data copied to user address 0000200000000080

CPU: 0 UID: 0 PID: 6052 Comm: syz.0.16 Not tainted 6.16.0-rc7-syzkaller #0 PREEMPT(none)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
=====================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

Arnaud Lecomte

unread,
Jul 24, 2025, 4:27:53 PM7/24/25
to syzbot+a5e45f...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
#syz test

--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -1636,7 +1636,7 @@ static int do_insn_ioctl(struct comedi_device *dev,
n_data = MAX_SAMPLES;
}

- data = kmalloc_array(n_data, sizeof(unsigned int), GFP_KERNEL);
+ data = kcalloc(n_data, sizeof(unsigned int), GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto error;
--

syzbot

unread,
Jul 24, 2025, 5:05:04 PM7/24/25
to con...@arnaud-lcm.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+a5e45f...@syzkaller.appspotmail.com
Tested-by: syzbot+a5e45f...@syzkaller.appspotmail.com

Tested on:

commit: dd9c1732 Merge tag 'sound-6.16' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14cc10a2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7753c32e11ff6a95
dashboard link: https://syzkaller.appspot.com/bug?extid=a5e45f768aab5892da5d
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=13a410a2580000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Jul 25, 2025, 6:21:26 AM7/25/25
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Re: [syzbot] [kernel?] KMSAN: kernel-infoleak in do_insn_ioctl
Author: abb...@mev.co.uk

#syz test

diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
index 23b7178522ae..360fde417016 100644
--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -1587,6 +1587,10 @@ static int do_insnlist_ioctl(struct comedi_device *dev,
memset(&data[n], 0, (MIN_SAMPLES - n) *
sizeof(unsigned int));
}
+ } else {
+ unsigned int n_min = max(n, (unsigned int)MIN_SAMPLES);
+
+ memset(data, 0, n_min * sizeof(unsigned int));
}
ret = parse_insn(dev, insns + i, data, file);
if (ret < 0)
@@ -1670,6 +1674,8 @@ static int do_insn_ioctl(struct comedi_device *dev,
memset(&data[insn->n], 0,
(MIN_SAMPLES - insn->n) * sizeof(unsigned int));
}
+ } else {
+ memset(data, 0, n_data * sizeof(unsigned int));
}
ret = parse_insn(dev, insn, data, file);
if (ret < 0)

syzbot

unread,
Jul 25, 2025, 6:51:04 AM7/25/25
to abb...@mev.co.uk, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+a5e45f...@syzkaller.appspotmail.com
Tested-by: syzbot+a5e45f...@syzkaller.appspotmail.com

Tested on:

commit: 2942242d Merge tag 'mm-hotfixes-stable-2025-07-24-18-0..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12fb94f0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7753c32e11ff6a95
dashboard link: https://syzkaller.appspot.com/bug?extid=a5e45f768aab5892da5d
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=151690a2580000
Reply all
Reply to author
Forward
0 new messages