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

6 views
Skip to first unread message

syzbot

unread,
Jul 21, 2025, 3:30:38 PM7/21/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=110a9382580000
kernel config: https://syzkaller.appspot.com/x/.config?x=5227c65742122bdd
dashboard link: https://syzkaller.appspot.com/bug?extid=fb4362a104d45ab09cf9
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/ae9623994cef/disk-e2291551.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/64b2bf4d3527/vmlinux-e2291551.xz
kernel image: https://storage.googleapis.com/syzbot-assets/05541379d4f6/bzImage-e2291551.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fb4362...@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_insnlist_ioctl+0x596/0x890 drivers/comedi/comedi_fops.c:1572
comedi_unlocked_ioctl+0x1c6b/0x1e00 drivers/comedi/comedi_fops.c:2253
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_insnlist_ioctl+0x1b2/0x890 drivers/comedi/comedi_fops.c:1551
comedi_unlocked_ioctl+0x1c6b/0x1e00 drivers/comedi/comedi_fops.c:2253
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 ffff888053394400

CPU: 1 UID: 0 PID: 22163 Comm: syz.9.4290 Not tainted 6.16.0-rc6-syzkaller-00037-ge2291551827f #0 PREEMPT(none)
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 25, 2025, 6:23:58 AM7/25/25
to abb...@mev.co.uk, abb...@mev.co.uk, linux-...@vger.kernel.org, syzkall...@googlegroups.com
> #syz test

This crash does not have a reproducer. I cannot test it.

>
> 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 31, 2025, 3:29:40 AM7/31/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: e8d780dcd957 Merge tag 'slab-for-6.17' of git://git.kernel..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=154b8f82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=30a934bba3cd727
dashboard link: https://syzkaller.appspot.com/bug?extid=fb4362a104d45ab09cf9
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=10a04ca2580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13a269bc580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f57c48189b63/disk-e8d780dc.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5b7ee73a2a25/vmlinux-e8d780dc.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e48af4e6a5c3/bzImage-e8d780dc.xz

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

comedi comedi3: 8255: I/O port conflict (0x2,4)
comedi comedi3: 8255: I/O port conflict (0x10000,4)
comedi comedi3: 8255: I/O port conflict (0x4,4)
comedi comedi3: 8255: I/O port conflict (0x4,4)
=====================================================
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_insnlist_ioctl+0x66e/0x930 drivers/comedi/comedi_fops.c:1595
comedi_unlocked_ioctl+0x1e78/0x1f60 drivers/comedi/comedi_fops.c:2293
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0x239/0x400 fs/ioctl.c:584
__x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:584
x64_sys_call+0x1cbc/0x3e20 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:2342 [inline]
slab_free mm/slub.c:4679 [inline]
kfree+0x252/0xec0 mm/slub.c:4878
tomoyo_supervisor+0xc57/0x3100 security/tomoyo/common.c:2250
tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
tomoyo_path_number_perm+0x4d8/0x7d0 security/tomoyo/file.c:734
tomoyo_file_ioctl+0x3d/0x50 security/tomoyo/tomoyo.c:350
security_file_ioctl+0x141/0x590 security/security.c:2943
__do_sys_ioctl fs/ioctl.c:592 [inline]
__se_sys_ioctl+0xbb/0x400 fs/ioctl.c:584
__x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:584
x64_sys_call+0x1cbc/0x3e20 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 ffff88814448f800

CPU: 1 UID: 0 PID: 5809 Comm: syz-executor572 Not tainted 6.16.0-syzkaller-06699-ge8d780dcd957 #0 PREEMPT(none)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/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.

Hillf Danton

unread,
Jul 31, 2025, 5:39:32 AM7/31/25
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
> Date: Thu, 31 Jul 2025 00:29:38 -0700 [thread overview]
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: e8d780dcd957 Merge tag 'slab-for-6.17' of git://git.kernel..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=154b8f82580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=30a934bba3cd727
> dashboard link: https://syzkaller.appspot.com/bug?extid=fb4362a104d45ab09cf9
#syz test

--- x/drivers/comedi/comedi_fops.c
+++ y/drivers/comedi/comedi_fops.c
@@ -1566,7 +1566,7 @@ static int do_insnlist_ioctl(struct come

/* Allocate scratch space for all instruction data. */
data = kmalloc_array(max_n_data_required, sizeof(unsigned int),
- GFP_KERNEL);
+ GFP_KERNEL | __GFP_ZERO);
if (!data) {
ret = -ENOMEM;
goto error;
--

syzbot

unread,
Jul 31, 2025, 7:03:06 AM7/31/25
to hda...@sina.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+fb4362...@syzkaller.appspotmail.com
Tested-by: syzbot+fb4362...@syzkaller.appspotmail.com

Tested on:

commit: 260f6f4f Merge tag 'drm-next-2025-07-30' of https://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16c32cf0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=abebb97635730ab2
dashboard link: https://syzkaller.appspot.com/bug?extid=fb4362a104d45ab09cf9
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=11f52cf0580000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages