public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
@ 2024-07-25  9:14 syzbot
  2024-09-04 12:00 ` syzbot
  0 siblings, 1 reply; 18+ messages in thread
From: syzbot @ 2024-07-25  9:14 UTC (permalink / raw)
  To: gregkh, linux-kernel, linux-usb, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    28bbe4ea686a Merge tag 'i2c-for-6.11-rc1-second-batch' of ..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1519f2b1980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fcd331f2f7452dee
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: i386

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5547f17fee20/disk-28bbe4ea.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d509f262f4fb/vmlinux-28bbe4ea.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1b4cf478d209/bzImage-28bbe4ea.xz

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

=====================================================
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usbtmc_write+0xc32/0x1220 drivers/usb/class/usbtmc.c:1606
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __ia32_sys_write+0x91/0xe0 fs/read_write.c:652
 ia32_sys_call+0x2e34/0x40d0 arch/x86/include/generated/asm/syscalls_32.h:5
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0xb0/0x110 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x38/0x80 arch/x86/entry/common.c:411
 do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:449
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Uninit was created at:
 slab_post_alloc_hook mm/slub.c:3994 [inline]
 slab_alloc_node mm/slub.c:4037 [inline]
 __kmalloc_cache_noprof+0x4f0/0xb00 mm/slub.c:4184
 kmalloc_noprof include/linux/slab.h:681 [inline]
 usbtmc_create_urb drivers/usb/class/usbtmc.c:757 [inline]
 usbtmc_write+0x3d3/0x1220 drivers/usb/class/usbtmc.c:1547
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __ia32_sys_write+0x91/0xe0 fs/read_write.c:652
 ia32_sys_call+0x2e34/0x40d0 arch/x86/include/generated/asm/syscalls_32.h:5
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0xb0/0x110 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x38/0x80 arch/x86/entry/common.c:411
 do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:449
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Byte 3587 of 3588 is uninitialized
Memory access of size 3588 starts at ffff88804d338000

CPU: 0 UID: 0 PID: 5392 Comm: syz.1.48 Not tainted 6.10.0-syzkaller-12084-g28bbe4ea686a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
=====================================================


---
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 syzkaller@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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-07-25  9:14 syzbot
@ 2024-09-04 12:00 ` syzbot
  2024-09-04 12:47   ` Edward Adam Davis
                     ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: syzbot @ 2024-09-04 12:00 UTC (permalink / raw)
  To: gregkh, linux-kernel, linux-usb, syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    88fac17500f4 Merge tag 'fuse-fixes-6.11-rc7' of git://git...
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12281339980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1702531f980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=150dd8af980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6e5a9ba13ba0/disk-88fac175.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/229238ec073e/vmlinux-88fac175.xz
kernel image: https://storage.googleapis.com/syzbot-assets/64327bdcda24/bzImage-88fac175.xz

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

=====================================================
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usbtmc_write+0xc32/0x1220 drivers/usb/class/usbtmc.c:1606
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __x64_sys_write+0x93/0xe0 fs/read_write.c:652
 x64_sys_call+0x306a/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
 slab_post_alloc_hook mm/slub.c:3994 [inline]
 slab_alloc_node mm/slub.c:4037 [inline]
 __kmalloc_cache_noprof+0x4f0/0xb00 mm/slub.c:4184
 kmalloc_noprof include/linux/slab.h:681 [inline]
 usbtmc_create_urb drivers/usb/class/usbtmc.c:757 [inline]
 usbtmc_write+0x3d3/0x1220 drivers/usb/class/usbtmc.c:1547
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __x64_sys_write+0x93/0xe0 fs/read_write.c:652
 x64_sys_call+0x306a/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Byte 15 of 16 is uninitialized
Memory access of size 16 starts at ffff88810bce7000

CPU: 0 UID: 0 PID: 5229 Comm: syz-executor195 Not tainted 6.11.0-rc6-syzkaller-00026-g88fac17500f4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
=====================================================


---
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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
@ 2024-09-04 12:47   ` Edward Adam Davis
  2024-09-04 13:33     ` syzbot
  2024-09-05 11:27   ` Edward Adam Davis
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-04 12:47 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

prevent kernel-infoleak.
We need to clear the structure before filling fields.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6bd9fe565385..e9ddaa9b580d 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -759,6 +759,7 @@ static struct urb *usbtmc_create_urb(void)
 		usb_free_urb(urb);
 		return NULL;
 	}
+	memset(dmabuf, 0, bufsize);
 
 	urb->transfer_buffer = dmabuf;
 	urb->transfer_buffer_length = bufsize;


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:47   ` Edward Adam Davis
@ 2024-09-04 13:33     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-04 13:33 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         88fac175 Merge tag 'fuse-fixes-6.11-rc7' of git://git...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14ac62ab980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17bf7f2f980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
       [not found] <20240905071112.1621278-1-lizhi.xu@windriver.com>
@ 2024-09-05  7:57 ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-05  7:57 UTC (permalink / raw)
  To: linux-kernel, lizhi.xu, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: kernel-usb-infoleak in usbtmc_write

=====================================================
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usbtmc_write+0xc4f/0x1240 drivers/usb/class/usbtmc.c:1607
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __x64_sys_write+0x93/0xe0 fs/read_write.c:652
 x64_sys_call+0x306a/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
 slab_post_alloc_hook mm/slub.c:3998 [inline]
 slab_alloc_node mm/slub.c:4041 [inline]
 __kmalloc_cache_noprof+0x4f0/0xb00 mm/slub.c:4188
 kmalloc_noprof include/linux/slab.h:681 [inline]
 usbtmc_create_urb drivers/usb/class/usbtmc.c:757 [inline]
 usbtmc_write+0x3d3/0x1240 drivers/usb/class/usbtmc.c:1547
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __x64_sys_write+0x93/0xe0 fs/read_write.c:652
 x64_sys_call+0x306a/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Byte 15 of 16 is uninitialized
Memory access of size 16 starts at ffff88810a6a0000

CPU: 0 UID: 0 PID: 6214 Comm: syz.3.81 Not tainted 6.11.0-rc6-syzkaller-00070-gc763c4339688-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
=====================================================


Tested on:

commit:         c763c433 Merge tag 'bcachefs-2024-09-04' of git://evil..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13324667980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15a7fd29980000


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
       [not found] <20240905082935.2536851-1-lizhi.xu@windriver.com>
@ 2024-09-05  8:59 ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-05  8:59 UTC (permalink / raw)
  To: linux-kernel, lizhi.xu, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KMSAN: kernel-usb-infoleak in usbtmc_write

xf size: 3, count: 3, usbtmc_write
=====================================================
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usb_submit_urb+0x597/0x2350 drivers/usb/core/urb.c:430
 usbtmc_write+0xb26/0x1270 drivers/usb/class/usbtmc.c:1608
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __x64_sys_write+0x93/0xe0 fs/read_write.c:652
 x64_sys_call+0x306a/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was created at:
 slab_post_alloc_hook mm/slub.c:3998 [inline]
 slab_alloc_node mm/slub.c:4041 [inline]
 __kmalloc_cache_noprof+0x4f0/0xb00 mm/slub.c:4188
 kmalloc_noprof include/linux/slab.h:681 [inline]
 usbtmc_create_urb drivers/usb/class/usbtmc.c:757 [inline]
 usbtmc_write+0x3d3/0x1270 drivers/usb/class/usbtmc.c:1547
 vfs_write+0x493/0x1550 fs/read_write.c:588
 ksys_write+0x20f/0x4c0 fs/read_write.c:643
 __do_sys_write fs/read_write.c:655 [inline]
 __se_sys_write fs/read_write.c:652 [inline]
 __x64_sys_write+0x93/0xe0 fs/read_write.c:652
 x64_sys_call+0x306a/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Byte 15 of 16 is uninitialized
Memory access of size 16 starts at ffff888117169000

CPU: 0 UID: 0 PID: 6369 Comm: syz.1.63 Not tainted 6.11.0-rc6-syzkaller-00070-gc763c4339688-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
=====================================================


Tested on:

commit:         c763c433 Merge tag 'bcachefs-2024-09-04' of git://evil..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=143420b3980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1055bd97980000


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
  2024-09-04 12:47   ` Edward Adam Davis
@ 2024-09-05 11:27   ` Edward Adam Davis
  2024-09-05 15:42     ` syzbot
  2024-09-05 14:21   ` Edward Adam Davis
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-05 11:27 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

clear save user data buf before copying data from user.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index e9ddaa9b580d..19bfe25e675c 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1586,6 +1586,7 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
 		aligned = (transfersize + (USBTMC_HEADER_SIZE + 3)) & ~3;
 	}
 
+	memset(&buffer[USBTMC_HEADER_SIZE], 0, aligned - count);
 	if (copy_from_user(&buffer[USBTMC_HEADER_SIZE], buf, transfersize)) {
 		retval = -EFAULT;
 		up(&file_data->limit_write_sem);


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
  2024-09-04 12:47   ` Edward Adam Davis
  2024-09-05 11:27   ` Edward Adam Davis
@ 2024-09-05 14:21   ` Edward Adam Davis
  2024-09-05 16:11     ` syzbot
  2024-09-06 11:55   ` Edward Adam Davis
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-05 14:21 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

clear save user data buf before copying data from user.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index e9ddaa9b580d..19bfe25e675c 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1586,6 +1586,7 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
 		aligned = (transfersize + (USBTMC_HEADER_SIZE + 3)) & ~3;
 	}
 
+	memset(&buffer[USBTMC_HEADER_SIZE], 0, aligned - USBTMC_HEADER_SIZE);
 	if (copy_from_user(&buffer[USBTMC_HEADER_SIZE], buf, transfersize)) {
 		retval = -EFAULT;
 		up(&file_data->limit_write_sem);


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-05 11:27   ` Edward Adam Davis
@ 2024-09-05 15:42     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-05 15:42 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         c763c433 Merge tag 'bcachefs-2024-09-04' of git://evil..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=139f168f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=14cb8f33980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-05 14:21   ` Edward Adam Davis
@ 2024-09-05 16:11     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-05 16:11 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         c763c433 Merge tag 'bcachefs-2024-09-04' of git://evil..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17fdbd97980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=170fae53980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
                     ` (2 preceding siblings ...)
  2024-09-05 14:21   ` Edward Adam Davis
@ 2024-09-06 11:55   ` Edward Adam Davis
  2024-09-06 12:29     ` syzbot
  2024-09-06 12:37   ` Edward Adam Davis
                     ` (2 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-06 11:55 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

Clear the buffer that has not been set, after copying data from user space.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6bd9fe565385..5159f1c01116 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1590,6 +1590,8 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
 		up(&file_data->limit_write_sem);
 		goto exit;
 	}
+	memset(&buffer[USBTMC_HEADER_SIZE + transfersize], 0,
+		aligned - USBTMC_HEADER_SIZE - transfersize);
 
 	dev_dbg(&data->intf->dev, "%s(size:%u align:%u)\n", __func__,
 		(unsigned int)transfersize, (unsigned int)aligned);


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-06 11:55   ` Edward Adam Davis
@ 2024-09-06 12:29     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-06 12:29 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         b831f83e Merge tag 'bpf-6.11-rc7' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10f429ab980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1404b6ab980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
                     ` (3 preceding siblings ...)
  2024-09-06 11:55   ` Edward Adam Davis
@ 2024-09-06 12:37   ` Edward Adam Davis
  2024-09-06 13:07     ` syzbot
  2024-09-06 13:06   ` Edward Adam Davis
  2024-09-06 13:52   ` Edward Adam Davis
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-06 12:37 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

Clear the buffer that has not been set, after copying data from user space.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6bd9fe565385..faf8c5508997 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1591,6 +1591,10 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
 		goto exit;
 	}
 
+	if (aligned < buflen)
+		memset(&buffer[USBTMC_HEADER_SIZE + transfersize], 0,
+			aligned - USBTMC_HEADER_SIZE - transfersize);
+
 	dev_dbg(&data->intf->dev, "%s(size:%u align:%u)\n", __func__,
 		(unsigned int)transfersize, (unsigned int)aligned);
 


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
                     ` (4 preceding siblings ...)
  2024-09-06 12:37   ` Edward Adam Davis
@ 2024-09-06 13:06   ` Edward Adam Davis
  2024-09-06 13:51     ` syzbot
  2024-09-06 13:52   ` Edward Adam Davis
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-06 13:06 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

Clear the buffer that has not been set, after copying data from user space.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6bd9fe565385..faf8c5508997 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1591,6 +1591,10 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
 		goto exit;
 	}
 
+	if (transfersize <= 3)
+		memset(&buffer[USBTMC_HEADER_SIZE + transfersize], 0,
+			aligned - USBTMC_HEADER_SIZE - transfersize);
+
 	dev_dbg(&data->intf->dev, "%s(size:%u align:%u)\n", __func__,
 		(unsigned int)transfersize, (unsigned int)aligned);
 


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-06 12:37   ` Edward Adam Davis
@ 2024-09-06 13:07     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-06 13:07 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         b831f83e Merge tag 'bpf-6.11-rc7' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1422348b980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15b3458f980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-06 13:06   ` Edward Adam Davis
@ 2024-09-06 13:51     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-06 13:51 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         b831f83e Merge tag 'bpf-6.11-rc7' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=110e8d8f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=16be13fb980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-04 12:00 ` syzbot
                     ` (5 preceding siblings ...)
  2024-09-06 13:06   ` Edward Adam Davis
@ 2024-09-06 13:52   ` Edward Adam Davis
  2024-09-06 16:59     ` syzbot
  6 siblings, 1 reply; 18+ messages in thread
From: Edward Adam Davis @ 2024-09-06 13:52 UTC (permalink / raw)
  To: syzbot+9d34f80f841e948c3fdb; +Cc: linux-kernel, syzkaller-bugs

Clear the buffer that has not been set, after copying data from user space.

#syz test

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6bd9fe565385..faf8c5508997 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1591,6 +1591,10 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
 		goto exit;
 	}
 
+	if (transfersize % 4)
+		memset(&buffer[USBTMC_HEADER_SIZE + transfersize], 0,
+			aligned - USBTMC_HEADER_SIZE - transfersize);
+
 	dev_dbg(&data->intf->dev, "%s(size:%u align:%u)\n", __func__,
 		(unsigned int)transfersize, (unsigned int)aligned);
 


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
  2024-09-06 13:52   ` Edward Adam Davis
@ 2024-09-06 16:59     ` syzbot
  0 siblings, 0 replies; 18+ messages in thread
From: syzbot @ 2024-09-06 16:59 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         b831f83e Merge tag 'bpf-6.11-rc7' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15a09167980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=35c699864e165c51
dashboard link: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=12b20709980000

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-09-06 16:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240905082935.2536851-1-lizhi.xu@windriver.com>
2024-09-05  8:59 ` [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write syzbot
     [not found] <20240905071112.1621278-1-lizhi.xu@windriver.com>
2024-09-05  7:57 ` syzbot
2024-07-25  9:14 syzbot
2024-09-04 12:00 ` syzbot
2024-09-04 12:47   ` Edward Adam Davis
2024-09-04 13:33     ` syzbot
2024-09-05 11:27   ` Edward Adam Davis
2024-09-05 15:42     ` syzbot
2024-09-05 14:21   ` Edward Adam Davis
2024-09-05 16:11     ` syzbot
2024-09-06 11:55   ` Edward Adam Davis
2024-09-06 12:29     ` syzbot
2024-09-06 12:37   ` Edward Adam Davis
2024-09-06 13:07     ` syzbot
2024-09-06 13:06   ` Edward Adam Davis
2024-09-06 13:51     ` syzbot
2024-09-06 13:52   ` Edward Adam Davis
2024-09-06 16:59     ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox