Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* divide error in usbtmc_generic_read
@ 2019-08-14 11:38 syzbot
  2019-08-14 13:25 ` Oliver Neukum
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: syzbot @ 2019-08-14 11:38 UTC (permalink / raw)
  To: andreyknvl, gregkh, guido.kiener, linux-kernel, linux-usb,
	steve_bayless, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    d0847550 usb-fuzzer: main usb gadget fuzzer driver
git tree:       https://github.com/google/kasan.git usb-fuzzer
console output: https://syzkaller.appspot.com/x/log.txt?x=16295d4a600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
dashboard link: https://syzkaller.appspot.com/bug?extid=55b0304b360654a7537b
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1288a31c600000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15282e86600000

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

divide error: 0000 [#1] SMP KASAN
CPU: 1 PID: 1761 Comm: syz-executor063 Not tainted 5.3.0-rc4+ #26
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:usbtmc_generic_read+0x135/0x1190 drivers/usb/class/usbtmc.c:816
Code: 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2  
0f 85 50 08 00 00 41 0f b7 6e 34 31 d2 31 ff 8b 44 24 28 <f7> f5 89 d6 41  
89 d4 e8 2f 54 c9 fd 44 8b 6c 24 28 45 85 e4 44 89
RSP: 0018:ffff8881d2b77a58 EFLAGS: 00010246
RAX: 0000000000000002 RBX: 000000004f894bad RCX: ffffffff837487cd
RDX: 0000000000000000 RSI: ffffffff837487da RDI: 0000000000000000
RBP: 0000000000000000 R08: ffff8881d20a0000 R09: ffffed103a56ef90
R10: ffffed103a56ef8f R11: 0000000000000003 R12: ffff8881d08e7180
R13: 0000000020000000 R14: ffff8881d0404c80 R15: ffff8881d08e7180
FS:  0000555555b74880(0000) GS:ffff8881db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000006cc090 CR3: 00000001d615e000 CR4: 00000000001406e0
Call Trace:
  usbtmc_ioctl_generic_read drivers/usb/class/usbtmc.c:1029 [inline]
  usbtmc_ioctl+0x27d/0x2ab0 drivers/usb/class/usbtmc.c:2089
  vfs_ioctl fs/ioctl.c:46 [inline]
  file_ioctl fs/ioctl.c:509 [inline]
  do_vfs_ioctl+0xd2d/0x1330 fs/ioctl.c:696
  ksys_ioctl+0x9b/0xc0 fs/ioctl.c:713
  __do_sys_ioctl fs/ioctl.c:720 [inline]
  __se_sys_ioctl fs/ioctl.c:718 [inline]
  __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:718
  do_syscall_64+0xb7/0x580 arch/x86/entry/common.c:296
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4419a9
Code: e8 8c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd0abd6738 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004419a9
RDX: 0000000020000000 RSI: 00000000c0145b0e RDI: 0000000000000004
RBP: 000000000000a984 R08: 000000000000000f R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402700
R13: 0000000000402790 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace a91d281a4d83213c ]---
RIP: 0010:usbtmc_generic_read+0x135/0x1190 drivers/usb/class/usbtmc.c:816
Code: 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2  
0f 85 50 08 00 00 41 0f b7 6e 34 31 d2 31 ff 8b 44 24 28 <f7> f5 89 d6 41  
89 d4 e8 2f 54 c9 fd 44 8b 6c 24 28 45 85 e4 44 89
RSP: 0018:ffff8881d2b77a58 EFLAGS: 00010246
RAX: 0000000000000002 RBX: 000000004f894bad RCX: ffffffff837487cd
RDX: 0000000000000000 RSI: ffffffff837487da RDI: 0000000000000000
RBP: 0000000000000000 R08: ffff8881d20a0000 R09: ffffed103a56ef90
R10: ffffed103a56ef8f R11: 0000000000000003 R12: ffff8881d08e7180
R13: 0000000020000000 R14: ffff8881d0404c80 R15: ffff8881d08e7180
FS:  0000555555b74880(0000) GS:ffff8881db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000006cc090 CR3: 00000001d615e000 CR4: 00000000001406e0


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

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

* Re: divide error in usbtmc_generic_read
  2019-08-14 11:38 divide error in usbtmc_generic_read syzbot
@ 2019-08-14 13:25 ` Oliver Neukum
  2019-08-14 13:38   ` syzbot
  2019-08-15 14:28 ` Oliver Neukum
  2019-11-19 13:35 ` Andrey Konovalov
  2 siblings, 1 reply; 16+ messages in thread
From: Oliver Neukum @ 2019-08-14 13:25 UTC (permalink / raw)
  To: syzbot, andreyknvl, syzkaller-bugs, steve_bayless, gregkh,
	guido.kiener, linux-usb

Am Mittwoch, den 14.08.2019, 04:38 -0700 schrieb syzbot:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:    d0847550 usb-fuzzer: main usb gadget fuzzer driver
> git tree:       https://github.com/google/kasan.git usb-fuzzer
> console output: https://syzkaller.appspot.com/x/log.txt?x=16295d4a600000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
> dashboard link: https://syzkaller.appspot.com/bug?extid=55b0304b360654a7537b
> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1288a31c600000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15282e86600000
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+55b0304b360654a7537b@syzkaller.appspotmail.com


#syz test: https://github.com/google/kasan.git d0847550

From 5fa900e86e57d92a0b23a1a60ff4f4f13e997a93 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Wed, 14 Aug 2019 15:21:41 +0200
Subject: [PATCH] usbtmc: more sanity checking for packet size

A malicious device can make the driver divide ny zero
with a nonsense maximum packet size.

SIgned-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/class/usbtmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 4942122b2346..11042ca56818 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -2364,6 +2364,8 @@ static int usbtmc_probe(struct usb_interface *intf,
 
 	data->bulk_in = bulk_in->bEndpointAddress;
 	data->wMaxPacketSize = usb_endpoint_maxp(bulk_in);
+	if (!data->wMaxPacketSize)
+		goto err_put;
 	dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in);
 
 	data->bulk_out = bulk_out->bEndpointAddress;
-- 
2.16.4


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

* Re: divide error in usbtmc_generic_read
  2019-08-14 13:25 ` Oliver Neukum
@ 2019-08-14 13:38   ` syzbot
  2019-08-14 13:52     ` Andrey Konovalov
  2019-08-15 13:31     ` Oliver Neukum
  0 siblings, 2 replies; 16+ messages in thread
From: syzbot @ 2019-08-14 13:38 UTC (permalink / raw)
  To: andreyknvl, gregkh, guido.kiener, linux-usb, oneukum,
	steve_bayless, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer still triggered  
crash:
KASAN: use-after-free Read in usbtmc_disconnect

usb 5-1: USB disconnect, device number 2
==================================================================
BUG: KASAN: use-after-free in __mutex_lock_common  
kernel/locking/mutex.c:912 [inline]
BUG: KASAN: use-after-free in __mutex_lock+0xf23/0x1360  
kernel/locking/mutex.c:1077
Read of size 8 at addr ffff8881d63299c8 by task kworker/1:0/17

CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.3.0-rc4+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0xca/0x13e lib/dump_stack.c:113
  print_address_description+0x6a/0x32c mm/kasan/report.c:351
  __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482
  kasan_report+0xe/0x12 mm/kasan/common.c:612
  __mutex_lock_common kernel/locking/mutex.c:912 [inline]
  __mutex_lock+0xf23/0x1360 kernel/locking/mutex.c:1077
  usbtmc_disconnect+0x58/0x180 drivers/usb/class/usbtmc.c:2443
  usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
  __device_release_driver drivers/base/dd.c:1134 [inline]
  device_release_driver_internal+0x42f/0x500 drivers/base/dd.c:1165
  bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
  device_del+0x420/0xb10 drivers/base/core.c:2339
  usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
  usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
  hub_port_connect drivers/usb/core/hub.c:4949 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
  port_event drivers/usb/core/hub.c:5359 [inline]
  hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
  process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
  worker_thread+0x96/0xe20 kernel/workqueue.c:2415
  kthread+0x318/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 1737:
  save_stack+0x1b/0x80 mm/kasan/common.c:69
  set_track mm/kasan/common.c:77 [inline]
  __kasan_kmalloc mm/kasan/common.c:487 [inline]
  __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:460
  kmalloc include/linux/slab.h:552 [inline]
  kzalloc include/linux/slab.h:748 [inline]
  usbtmc_probe+0xad/0x1360 drivers/usb/class/usbtmc.c:2328
  usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
  really_probe+0x281/0x6d0 drivers/base/dd.c:548
  driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
  __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
  bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
  __device_attach+0x217/0x360 drivers/base/dd.c:894
  bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
  device_add+0xae6/0x16f0 drivers/base/core.c:2165
  usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
  generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
  usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
  really_probe+0x281/0x6d0 drivers/base/dd.c:548
  driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
  __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
  bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
  __device_attach+0x217/0x360 drivers/base/dd.c:894
  bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
  device_add+0xae6/0x16f0 drivers/base/core.c:2165
  usb_new_device.cold+0x6a4/0xe79 drivers/usb/core/hub.c:2536
  hub_port_connect drivers/usb/core/hub.c:5098 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
  port_event drivers/usb/core/hub.c:5359 [inline]
  hub_event+0x1b5c/0x3640 drivers/usb/core/hub.c:5441
  process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
  worker_thread+0x96/0xe20 kernel/workqueue.c:2415
  kthread+0x318/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Freed by task 1737:
  save_stack+0x1b/0x80 mm/kasan/common.c:69
  set_track mm/kasan/common.c:77 [inline]
  __kasan_slab_free+0x130/0x180 mm/kasan/common.c:449
  slab_free_hook mm/slub.c:1423 [inline]
  slab_free_freelist_hook mm/slub.c:1474 [inline]
  slab_free mm/slub.c:3016 [inline]
  kfree+0xe4/0x2f0 mm/slub.c:3957
  kref_put include/linux/kref.h:65 [inline]
  usbtmc_probe+0x55c/0x1360 drivers/usb/class/usbtmc.c:2433
  usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
  really_probe+0x281/0x6d0 drivers/base/dd.c:548
  driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
  __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
  bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
  __device_attach+0x217/0x360 drivers/base/dd.c:894
  bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
  device_add+0xae6/0x16f0 drivers/base/core.c:2165
  usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
  generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
  usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
  really_probe+0x281/0x6d0 drivers/base/dd.c:548
  driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
  __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
  bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
  __device_attach+0x217/0x360 drivers/base/dd.c:894
  bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
  device_add+0xae6/0x16f0 drivers/base/core.c:2165
  usb_new_device.cold+0x6a4/0xe79 drivers/usb/core/hub.c:2536
  hub_port_connect drivers/usb/core/hub.c:5098 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
  port_event drivers/usb/core/hub.c:5359 [inline]
  hub_event+0x1b5c/0x3640 drivers/usb/core/hub.c:5441
  process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
  worker_thread+0x96/0xe20 kernel/workqueue.c:2415
  kthread+0x318/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8881d6329900
  which belongs to the cache kmalloc-512 of size 512
The buggy address is located 200 bytes inside of
  512-byte region [ffff8881d6329900, ffff8881d6329b00)
The buggy address belongs to the page:
page:ffffea000758ca00 refcount:1 mapcount:0 mapping:ffff8881da002500  
index:0x0 compound_mapcount: 0
flags: 0x200000000010200(slab|head)
raw: 0200000000010200 ffffea0007585680 0000000700000007 ffff8881da002500
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff8881d6329880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
  ffff8881d6329900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8881d6329980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                               ^
  ffff8881d6329a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff8881d6329a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


Tested on:

commit:         d0847550 usb-fuzzer: main usb gadget fuzzer driver
git tree:       https://github.com/google/kasan.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10ac29ee600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
patch:          https://syzkaller.appspot.com/x/patch.diff?x=11f3b2e2600000


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

* Re: divide error in usbtmc_generic_read
  2019-08-14 13:38   ` syzbot
@ 2019-08-14 13:52     ` Andrey Konovalov
  2019-08-15 13:31     ` Oliver Neukum
  1 sibling, 0 replies; 16+ messages in thread
From: Andrey Konovalov @ 2019-08-14 13:52 UTC (permalink / raw)
  To: syzbot
  Cc: Greg Kroah-Hartman, guido.kiener, USB list, Oliver Neukum,
	steve_bayless, syzkaller-bugs

On Wed, Aug 14, 2019 at 3:38 PM syzbot
<syzbot+55b0304b360654a7537b@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot has tested the proposed patch but the reproducer still triggered
> crash:
> KASAN: use-after-free Read in usbtmc_disconnect

Looks like a different bug in the same driver that gets triggered by
the same reproducer =)

You fix looks good to me.

>
> usb 5-1: USB disconnect, device number 2
> ==================================================================
> BUG: KASAN: use-after-free in __mutex_lock_common
> kernel/locking/mutex.c:912 [inline]
> BUG: KASAN: use-after-free in __mutex_lock+0xf23/0x1360
> kernel/locking/mutex.c:1077
> Read of size 8 at addr ffff8881d63299c8 by task kworker/1:0/17
>
> CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.3.0-rc4+ #1
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Workqueue: usb_hub_wq hub_event
> Call Trace:
>   __dump_stack lib/dump_stack.c:77 [inline]
>   dump_stack+0xca/0x13e lib/dump_stack.c:113
>   print_address_description+0x6a/0x32c mm/kasan/report.c:351
>   __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482
>   kasan_report+0xe/0x12 mm/kasan/common.c:612
>   __mutex_lock_common kernel/locking/mutex.c:912 [inline]
>   __mutex_lock+0xf23/0x1360 kernel/locking/mutex.c:1077
>   usbtmc_disconnect+0x58/0x180 drivers/usb/class/usbtmc.c:2443
>   usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
>   __device_release_driver drivers/base/dd.c:1134 [inline]
>   device_release_driver_internal+0x42f/0x500 drivers/base/dd.c:1165
>   bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
>   device_del+0x420/0xb10 drivers/base/core.c:2339
>   usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
>   usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
>   hub_port_connect drivers/usb/core/hub.c:4949 [inline]
>   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
>   port_event drivers/usb/core/hub.c:5359 [inline]
>   hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
>   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
>   worker_thread+0x96/0xe20 kernel/workqueue.c:2415
>   kthread+0x318/0x420 kernel/kthread.c:255
>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>
> Allocated by task 1737:
>   save_stack+0x1b/0x80 mm/kasan/common.c:69
>   set_track mm/kasan/common.c:77 [inline]
>   __kasan_kmalloc mm/kasan/common.c:487 [inline]
>   __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:460
>   kmalloc include/linux/slab.h:552 [inline]
>   kzalloc include/linux/slab.h:748 [inline]
>   usbtmc_probe+0xad/0x1360 drivers/usb/class/usbtmc.c:2328
>   usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
>   really_probe+0x281/0x6d0 drivers/base/dd.c:548
>   driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
>   bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
>   __device_attach+0x217/0x360 drivers/base/dd.c:894
>   bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
>   device_add+0xae6/0x16f0 drivers/base/core.c:2165
>   usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
>   generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
>   usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
>   really_probe+0x281/0x6d0 drivers/base/dd.c:548
>   driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
>   bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
>   __device_attach+0x217/0x360 drivers/base/dd.c:894
>   bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
>   device_add+0xae6/0x16f0 drivers/base/core.c:2165
>   usb_new_device.cold+0x6a4/0xe79 drivers/usb/core/hub.c:2536
>   hub_port_connect drivers/usb/core/hub.c:5098 [inline]
>   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
>   port_event drivers/usb/core/hub.c:5359 [inline]
>   hub_event+0x1b5c/0x3640 drivers/usb/core/hub.c:5441
>   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
>   worker_thread+0x96/0xe20 kernel/workqueue.c:2415
>   kthread+0x318/0x420 kernel/kthread.c:255
>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>
> Freed by task 1737:
>   save_stack+0x1b/0x80 mm/kasan/common.c:69
>   set_track mm/kasan/common.c:77 [inline]
>   __kasan_slab_free+0x130/0x180 mm/kasan/common.c:449
>   slab_free_hook mm/slub.c:1423 [inline]
>   slab_free_freelist_hook mm/slub.c:1474 [inline]
>   slab_free mm/slub.c:3016 [inline]
>   kfree+0xe4/0x2f0 mm/slub.c:3957
>   kref_put include/linux/kref.h:65 [inline]
>   usbtmc_probe+0x55c/0x1360 drivers/usb/class/usbtmc.c:2433
>   usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
>   really_probe+0x281/0x6d0 drivers/base/dd.c:548
>   driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
>   bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
>   __device_attach+0x217/0x360 drivers/base/dd.c:894
>   bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
>   device_add+0xae6/0x16f0 drivers/base/core.c:2165
>   usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
>   generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
>   usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
>   really_probe+0x281/0x6d0 drivers/base/dd.c:548
>   driver_probe_device+0x101/0x1b0 drivers/base/dd.c:721
>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828
>   bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:454
>   __device_attach+0x217/0x360 drivers/base/dd.c:894
>   bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
>   device_add+0xae6/0x16f0 drivers/base/core.c:2165
>   usb_new_device.cold+0x6a4/0xe79 drivers/usb/core/hub.c:2536
>   hub_port_connect drivers/usb/core/hub.c:5098 [inline]
>   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
>   port_event drivers/usb/core/hub.c:5359 [inline]
>   hub_event+0x1b5c/0x3640 drivers/usb/core/hub.c:5441
>   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
>   worker_thread+0x96/0xe20 kernel/workqueue.c:2415
>   kthread+0x318/0x420 kernel/kthread.c:255
>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>
> The buggy address belongs to the object at ffff8881d6329900
>   which belongs to the cache kmalloc-512 of size 512
> The buggy address is located 200 bytes inside of
>   512-byte region [ffff8881d6329900, ffff8881d6329b00)
> The buggy address belongs to the page:
> page:ffffea000758ca00 refcount:1 mapcount:0 mapping:ffff8881da002500
> index:0x0 compound_mapcount: 0
> flags: 0x200000000010200(slab|head)
> raw: 0200000000010200 ffffea0007585680 0000000700000007 ffff8881da002500
> raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
>   ffff8881d6329880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>   ffff8881d6329900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> > ffff8881d6329980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>                                                ^
>   ffff8881d6329a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>   ffff8881d6329a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================
>
>
> Tested on:
>
> commit:         d0847550 usb-fuzzer: main usb gadget fuzzer driver
> git tree:       https://github.com/google/kasan.git
> console output: https://syzkaller.appspot.com/x/log.txt?x=10ac29ee600000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> patch:          https://syzkaller.appspot.com/x/patch.diff?x=11f3b2e2600000
>

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

* Re: divide error in usbtmc_generic_read
  2019-08-14 13:38   ` syzbot
  2019-08-14 13:52     ` Andrey Konovalov
@ 2019-08-15 13:31     ` Oliver Neukum
  2019-08-19 12:17       ` Andrey Konovalov
  1 sibling, 1 reply; 16+ messages in thread
From: Oliver Neukum @ 2019-08-15 13:31 UTC (permalink / raw)
  To: syzbot, andreyknvl, syzkaller-bugs, steve_bayless, gregkh,
	guido.kiener, linux-usb

Am Mittwoch, den 14.08.2019, 06:38 -0700 schrieb syzbot:
> syzbot has tested the proposed patch but the reproducer still triggered  
> crash:
> KASAN: use-after-free Read in usbtmc_disconnect

I am afraid that is a difficiency in KASAN that should be fixed.
Is the class of the error compared if I leave in more of the
original bug report? Actually the ID is still there, so it really
should return an inconclusive in these cases.

	Regards
		Oliver


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

* Re: divide error in usbtmc_generic_read
  2019-08-14 11:38 divide error in usbtmc_generic_read syzbot
  2019-08-14 13:25 ` Oliver Neukum
@ 2019-08-15 14:28 ` Oliver Neukum
  2019-08-15 14:48   ` syzbot
  2019-11-19 13:35 ` Andrey Konovalov
  2 siblings, 1 reply; 16+ messages in thread
From: Oliver Neukum @ 2019-08-15 14:28 UTC (permalink / raw)
  To: syzbot, andreyknvl, syzkaller-bugs, steve_bayless, gregkh,
	guido.kiener, linux-usb

Am Mittwoch, den 14.08.2019, 04:38 -0700 schrieb syzbot:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:    d0847550 usb-fuzzer: main usb gadget fuzzer driver
> git tree:       https://github.com/google/kasan.git usb-fuzzer
> console output: https://syzkaller.appspot.com/x/log.txt?x=16295d4a600000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
> dashboard link: https://syzkaller.appspot.com/bug?extid=55b0304b360654a7537b
> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1288a31c600000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15282e86600000
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+55b0304b360654a7537b@syzkaller.appspotmail.com

#syz test: https://github.com/google/kasan.git d0847550

From df64f5cd2e6a9b43c75bb7e3276b8805a225db75 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Wed, 14 Aug 2019 15:21:41 +0200
Subject: [PATCH] usbtmc: more sanity checking for packet size

A malicious device can make the driver divide ny zero
with a nonsense maximum packet size.

V2: return a sensible error code

SIgned-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/class/usbtmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 4942122b2346..36858ddd8d9b 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -2362,8 +2362,11 @@ static int usbtmc_probe(struct usb_interface *intf,
 		goto err_put;
 	}
 
+	retcode = -EINVAL;
 	data->bulk_in = bulk_in->bEndpointAddress;
 	data->wMaxPacketSize = usb_endpoint_maxp(bulk_in);
+	if (!data->wMaxPacketSize)
+		goto err_put;
 	dev_dbg(&intf->dev, "Found bulk in endpoint at %u\n", data->bulk_in);
 
 	data->bulk_out = bulk_out->bEndpointAddress;
-- 
2.16.4


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

* Re: divide error in usbtmc_generic_read
  2019-08-15 14:28 ` Oliver Neukum
@ 2019-08-15 14:48   ` syzbot
  0 siblings, 0 replies; 16+ messages in thread
From: syzbot @ 2019-08-15 14:48 UTC (permalink / raw)
  To: andreyknvl, gregkh, guido.kiener, linux-usb, oneukum,
	steve_bayless, syzkaller-bugs

Hello,

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

Reported-and-tested-by:  
syzbot+55b0304b360654a7537b@syzkaller.appspotmail.com

Tested on:

commit:         d0847550 usb-fuzzer: main usb gadget fuzzer driver
git tree:       https://github.com/google/kasan.git
kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15e22d02600000

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

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

* Re: divide error in usbtmc_generic_read
  2019-08-15 13:31     ` Oliver Neukum
@ 2019-08-19 12:17       ` Andrey Konovalov
  2019-08-19 12:37         ` Oliver Neukum
  0 siblings, 1 reply; 16+ messages in thread
From: Andrey Konovalov @ 2019-08-19 12:17 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: syzbot, syzkaller-bugs, steve_bayless, Greg Kroah-Hartman,
	guido.kiener, USB list

On Thu, Aug 15, 2019 at 3:31 PM Oliver Neukum <oneukum@suse.com> wrote:
>
> Am Mittwoch, den 14.08.2019, 06:38 -0700 schrieb syzbot:
> > syzbot has tested the proposed patch but the reproducer still triggered
> > crash:
> > KASAN: use-after-free Read in usbtmc_disconnect
>
> I am afraid that is a difficiency in KASAN that should be fixed.
> Is the class of the error compared if I leave in more of the
> original bug report? Actually the ID is still there, so it really
> should return an inconclusive in these cases.

I don't get this, what kind of deficiency do you mean?

Anyway, looks like I was wrong, the reported use-after-free is caused
by an incomplete fix, and setting the right retcode fixes the
use-after-free.

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

* Re: divide error in usbtmc_generic_read
  2019-08-19 12:17       ` Andrey Konovalov
@ 2019-08-19 12:37         ` Oliver Neukum
  2019-08-19 12:43           ` Andrey Konovalov
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Neukum @ 2019-08-19 12:37 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

Am Montag, den 19.08.2019, 14:17 +0200 schrieb Andrey Konovalov:
> On Thu, Aug 15, 2019 at 3:31 PM Oliver Neukum <oneukum@suse.com> wrote:
> > 
> > Am Mittwoch, den 14.08.2019, 06:38 -0700 schrieb syzbot:
> > > syzbot has tested the proposed patch but the reproducer still triggered
> > > crash:
> > > KASAN: use-after-free Read in usbtmc_disconnect
> > 
> > I am afraid that is a difficiency in KASAN that should be fixed.
> > Is the class of the error compared if I leave in more of the
> > original bug report? Actually the ID is still there, so it really
> > should return an inconclusive in these cases.
> 
> I don't get this, what kind of deficiency do you mean?

The original error was a divide by zero. The first fix fixed that
but still another error showed up. If I propose a fix there are
other possibilities besides it working.

I could have no effect on the original bug or my fix breaks
something else and KASAN is making no difference between
those cases.

	Regards
		Oliver


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

* Re: divide error in usbtmc_generic_read
  2019-08-19 12:37         ` Oliver Neukum
@ 2019-08-19 12:43           ` Andrey Konovalov
  2019-08-19 13:09             ` Oliver Neukum
  0 siblings, 1 reply; 16+ messages in thread
From: Andrey Konovalov @ 2019-08-19 12:43 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

On Mon, Aug 19, 2019 at 2:37 PM Oliver Neukum <oneukum@suse.com> wrote:
>
> Am Montag, den 19.08.2019, 14:17 +0200 schrieb Andrey Konovalov:
> > On Thu, Aug 15, 2019 at 3:31 PM Oliver Neukum <oneukum@suse.com> wrote:
> > >
> > > Am Mittwoch, den 14.08.2019, 06:38 -0700 schrieb syzbot:
> > > > syzbot has tested the proposed patch but the reproducer still triggered
> > > > crash:
> > > > KASAN: use-after-free Read in usbtmc_disconnect
> > >
> > > I am afraid that is a difficiency in KASAN that should be fixed.
> > > Is the class of the error compared if I leave in more of the
> > > original bug report? Actually the ID is still there, so it really
> > > should return an inconclusive in these cases.
> >
> > I don't get this, what kind of deficiency do you mean?
>
> The original error was a divide by zero. The first fix fixed that
> but still another error showed up. If I propose a fix there are
> other possibilities besides it working.
>
> I could have no effect on the original bug or my fix breaks
> something else and KASAN is making no difference between
> those cases.

I think you mean syzbot here and not KASAN. Do I understand correctly,
that you're saying that the original report was divide-by-zero, but
when you requested to test the patch the reproducer triggered a
use-after-free, and syzbot didn't treat the patch you provided as a
correct fix? In this case this is working as intended, as a bug
(especially some race) can manifest in different ways, so the kernel
might crash with a different stack trace.

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

* Re: divide error in usbtmc_generic_read
  2019-08-19 12:43           ` Andrey Konovalov
@ 2019-08-19 13:09             ` Oliver Neukum
  2019-08-19 13:18               ` Andrey Konovalov
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Neukum @ 2019-08-19 13:09 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

Am Montag, den 19.08.2019, 14:43 +0200 schrieb Andrey Konovalov:
> On Mon, Aug 19, 2019 at 2:37 PM Oliver Neukum <oneukum@suse.com> wrote:

> > The original error was a divide by zero. The first fix fixed that
> > but still another error showed up. If I propose a fix there are
> > other possibilities besides it working.
> > 
> > I could have no effect on the original bug or my fix breaks
> > something else and KASAN is making no difference between
> > those cases.
> 
> I think you mean syzbot here and not KASAN. Do I understand correctly,
> that you're saying that the original report was 

Yes, sorry syzbot.

> divide-by-zero, but
> when you requested to test the patch the reproducer triggered a
> use-after-free, and syzbot didn't treat the patch you provided as a
> correct fix?

No, obviously there is still a bug. What I would like syzbot to have
would be a third category: inconclusive.
Seeing another bug instead may also mean the first bug struck
before the second could ever happen. We just lack data to tell.

	Regards
		Oliver


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

* Re: divide error in usbtmc_generic_read
  2019-08-19 13:09             ` Oliver Neukum
@ 2019-08-19 13:18               ` Andrey Konovalov
  2019-08-19 13:49                 ` Oliver Neukum
  0 siblings, 1 reply; 16+ messages in thread
From: Andrey Konovalov @ 2019-08-19 13:18 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

On Mon, Aug 19, 2019 at 3:09 PM Oliver Neukum <oneukum@suse.com> wrote:
>
> Am Montag, den 19.08.2019, 14:43 +0200 schrieb Andrey Konovalov:
> > On Mon, Aug 19, 2019 at 2:37 PM Oliver Neukum <oneukum@suse.com> wrote:
>
> > > The original error was a divide by zero. The first fix fixed that
> > > but still another error showed up. If I propose a fix there are
> > > other possibilities besides it working.
> > >
> > > I could have no effect on the original bug or my fix breaks
> > > something else and KASAN is making no difference between
> > > those cases.
> >
> > I think you mean syzbot here and not KASAN. Do I understand correctly,
> > that you're saying that the original report was
>
> Yes, sorry syzbot.
>
> > divide-by-zero, but
> > when you requested to test the patch the reproducer triggered a
> > use-after-free, and syzbot didn't treat the patch you provided as a
> > correct fix?
>
> No, obviously there is still a bug. What I would like syzbot to have
> would be a third category: inconclusive.
> Seeing another bug instead may also mean the first bug struck
> before the second could ever happen. We just lack data to tell.

OK, I see. The exact words that syzbot uses in this case are "syzbot
has tested the proposed patch but the reproducer still triggered
crash". What would you like to see instead?

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

* Re: divide error in usbtmc_generic_read
  2019-08-19 13:18               ` Andrey Konovalov
@ 2019-08-19 13:49                 ` Oliver Neukum
  2019-08-19 15:40                   ` Andrey Konovalov
  0 siblings, 1 reply; 16+ messages in thread
From: Oliver Neukum @ 2019-08-19 13:49 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

Am Montag, den 19.08.2019, 15:18 +0200 schrieb Andrey Konovalov:
> On Mon, Aug 19, 2019 at 3:09 PM Oliver Neukum <oneukum@suse.com> wrote:
> > 
> > Am Montag, den 19.08.2019, 14:43 +0200 schrieb Andrey Konovalov:
> > > On Mon, Aug 19, 2019 at 2:37 PM Oliver Neukum <oneukum@suse.com> wrote:
> > > > The original error was a divide by zero. The first fix fixed that
> > > > but still another error showed up. If I propose a fix there are
> > > > other possibilities besides it working.
> > > > 
> > > > I could have no effect on the original bug or my fix breaks
> > > > something else and KASAN is making no difference between
> > > > those cases.
> > > 
> > > I think you mean syzbot here and not KASAN. Do I understand correctly,
> > > that you're saying that the original report was
> > 
> > Yes, sorry syzbot.
> > 
> > > divide-by-zero, but
> > > when you requested to test the patch the reproducer triggered a
> > > use-after-free, and syzbot didn't treat the patch you provided as a
> > > correct fix?
> > 
> > No, obviously there is still a bug. What I would like syzbot to have
> > would be a third category: inconclusive.
> > Seeing another bug instead may also mean the first bug struck
> > before the second could ever happen. We just lack data to tell.
> 
> OK, I see. The exact words that syzbot uses in this case are "syzbot
> has tested the proposed patch but the reproducer still triggered
> crash". What would you like to see instead?
> 

"syzbot has tested the proposed patch but the reproducer triggered
another crash" would make it clearer.

	Regards
		Oliver


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

* Re: divide error in usbtmc_generic_read
  2019-08-19 13:49                 ` Oliver Neukum
@ 2019-08-19 15:40                   ` Andrey Konovalov
  2019-08-20  9:01                     ` Oliver Neukum
  0 siblings, 1 reply; 16+ messages in thread
From: Andrey Konovalov @ 2019-08-19 15:40 UTC (permalink / raw)
  To: Oliver Neukum, Dmitry Vyukov
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

On Mon, Aug 19, 2019 at 3:49 PM Oliver Neukum <oneukum@suse.com> wrote:
>
> Am Montag, den 19.08.2019, 15:18 +0200 schrieb Andrey Konovalov:
> > On Mon, Aug 19, 2019 at 3:09 PM Oliver Neukum <oneukum@suse.com> wrote:
> > >
> > > Am Montag, den 19.08.2019, 14:43 +0200 schrieb Andrey Konovalov:
> > > > On Mon, Aug 19, 2019 at 2:37 PM Oliver Neukum <oneukum@suse.com> wrote:
> > > > > The original error was a divide by zero. The first fix fixed that
> > > > > but still another error showed up. If I propose a fix there are
> > > > > other possibilities besides it working.
> > > > >
> > > > > I could have no effect on the original bug or my fix breaks
> > > > > something else and KASAN is making no difference between
> > > > > those cases.
> > > >
> > > > I think you mean syzbot here and not KASAN. Do I understand correctly,
> > > > that you're saying that the original report was
> > >
> > > Yes, sorry syzbot.
> > >
> > > > divide-by-zero, but
> > > > when you requested to test the patch the reproducer triggered a
> > > > use-after-free, and syzbot didn't treat the patch you provided as a
> > > > correct fix?
> > >
> > > No, obviously there is still a bug. What I would like syzbot to have
> > > would be a third category: inconclusive.
> > > Seeing another bug instead may also mean the first bug struck
> > > before the second could ever happen. We just lack data to tell.
> >
> > OK, I see. The exact words that syzbot uses in this case are "syzbot
> > has tested the proposed patch but the reproducer still triggered
> > crash". What would you like to see instead?
> >
>
> "syzbot has tested the proposed patch but the reproducer triggered
> another crash" would make it clearer.

This implies that we can differentiate between different crashes. We
can differentiate between different manifestations of crashes, but
those can be caused by the same bug. I think we can remove the word
"still" though, so the words will be: "syzbot has tested the proposed
patch, but the reproducer triggered a crash".

Dmitry, WDYT?

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

* Re: divide error in usbtmc_generic_read
  2019-08-19 15:40                   ` Andrey Konovalov
@ 2019-08-20  9:01                     ` Oliver Neukum
  0 siblings, 0 replies; 16+ messages in thread
From: Oliver Neukum @ 2019-08-20  9:01 UTC (permalink / raw)
  To: Andrey Konovalov, Dmitry Vyukov
  Cc: syzkaller-bugs, steve_bayless, Greg Kroah-Hartman, guido.kiener,
	syzbot, USB list

Am Montag, den 19.08.2019, 17:40 +0200 schrieb Andrey Konovalov:
> 
> This implies that we can differentiate between different crashes. We
> can differentiate between different manifestations of crashes, but
> those can be caused by the same bug. I think we can remove the word
> "still" though, so the words will be: "syzbot has tested the proposed
> patch, but the reproducer triggered a crash".

That is exactly my point. There are three cases:

- no crash
- clearly the same crash
- something

Yet syzbot has two answers only. We are killing information needlessly.

	Regards
		Oliver


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

* Re: divide error in usbtmc_generic_read
  2019-08-14 11:38 divide error in usbtmc_generic_read syzbot
  2019-08-14 13:25 ` Oliver Neukum
  2019-08-15 14:28 ` Oliver Neukum
@ 2019-11-19 13:35 ` Andrey Konovalov
  2 siblings, 0 replies; 16+ messages in thread
From: Andrey Konovalov @ 2019-11-19 13:35 UTC (permalink / raw)
  To: syzbot
  Cc: Greg Kroah-Hartman, guido.kiener, LKML, USB list, steve_bayless,
	syzkaller-bugs

On Wed, Aug 14, 2019 at 1:38 PM syzbot
<syzbot+55b0304b360654a7537b@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit:    d0847550 usb-fuzzer: main usb gadget fuzzer driver
> git tree:       https://github.com/google/kasan.git usb-fuzzer
> console output: https://syzkaller.appspot.com/x/log.txt?x=16295d4a600000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=dbc9c80cc095da19
> dashboard link: https://syzkaller.appspot.com/bug?extid=55b0304b360654a7537b
> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1288a31c600000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15282e86600000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+55b0304b360654a7537b@syzkaller.appspotmail.com
>
> divide error: 0000 [#1] SMP KASAN
> CPU: 1 PID: 1761 Comm: syz-executor063 Not tainted 5.3.0-rc4+ #26
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> RIP: 0010:usbtmc_generic_read+0x135/0x1190 drivers/usb/class/usbtmc.c:816
> Code: 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2
> 0f 85 50 08 00 00 41 0f b7 6e 34 31 d2 31 ff 8b 44 24 28 <f7> f5 89 d6 41
> 89 d4 e8 2f 54 c9 fd 44 8b 6c 24 28 45 85 e4 44 89
> RSP: 0018:ffff8881d2b77a58 EFLAGS: 00010246
> RAX: 0000000000000002 RBX: 000000004f894bad RCX: ffffffff837487cd
> RDX: 0000000000000000 RSI: ffffffff837487da RDI: 0000000000000000
> RBP: 0000000000000000 R08: ffff8881d20a0000 R09: ffffed103a56ef90
> R10: ffffed103a56ef8f R11: 0000000000000003 R12: ffff8881d08e7180
> R13: 0000000020000000 R14: ffff8881d0404c80 R15: ffff8881d08e7180
> FS:  0000555555b74880(0000) GS:ffff8881db300000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00000000006cc090 CR3: 00000001d615e000 CR4: 00000000001406e0
> Call Trace:
>   usbtmc_ioctl_generic_read drivers/usb/class/usbtmc.c:1029 [inline]
>   usbtmc_ioctl+0x27d/0x2ab0 drivers/usb/class/usbtmc.c:2089
>   vfs_ioctl fs/ioctl.c:46 [inline]
>   file_ioctl fs/ioctl.c:509 [inline]
>   do_vfs_ioctl+0xd2d/0x1330 fs/ioctl.c:696
>   ksys_ioctl+0x9b/0xc0 fs/ioctl.c:713
>   __do_sys_ioctl fs/ioctl.c:720 [inline]
>   __se_sys_ioctl fs/ioctl.c:718 [inline]
>   __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:718
>   do_syscall_64+0xb7/0x580 arch/x86/entry/common.c:296
>   entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x4419a9
> Code: e8 8c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7
> 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
> ff 0f 83 cb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007ffd0abd6738 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004419a9
> RDX: 0000000020000000 RSI: 00000000c0145b0e RDI: 0000000000000004
> RBP: 000000000000a984 R08: 000000000000000f R09: 00000000004002c8
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402700
> R13: 0000000000402790 R14: 0000000000000000 R15: 0000000000000000
> Modules linked in:
> ---[ end trace a91d281a4d83213c ]---
> RIP: 0010:usbtmc_generic_read+0x135/0x1190 drivers/usb/class/usbtmc.c:816
> Code: 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 01 38 d0 7c 08 84 d2
> 0f 85 50 08 00 00 41 0f b7 6e 34 31 d2 31 ff 8b 44 24 28 <f7> f5 89 d6 41
> 89 d4 e8 2f 54 c9 fd 44 8b 6c 24 28 45 85 e4 44 89
> RSP: 0018:ffff8881d2b77a58 EFLAGS: 00010246
> RAX: 0000000000000002 RBX: 000000004f894bad RCX: ffffffff837487cd
> RDX: 0000000000000000 RSI: ffffffff837487da RDI: 0000000000000000
> RBP: 0000000000000000 R08: ffff8881d20a0000 R09: ffffed103a56ef90
> R10: ffffed103a56ef8f R11: 0000000000000003 R12: ffff8881d08e7180
> R13: 0000000020000000 R14: ffff8881d0404c80 R15: ffff8881d08e7180
> FS:  0000555555b74880(0000) GS:ffff8881db300000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00000000006cc090 CR3: 00000001d615e000 CR4: 00000000001406e0
>
>
> ---
> This bug 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 bug report. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches

#syz fix: usbtmc: more sanity checking for packet size

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

end of thread, back to index

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 11:38 divide error in usbtmc_generic_read syzbot
2019-08-14 13:25 ` Oliver Neukum
2019-08-14 13:38   ` syzbot
2019-08-14 13:52     ` Andrey Konovalov
2019-08-15 13:31     ` Oliver Neukum
2019-08-19 12:17       ` Andrey Konovalov
2019-08-19 12:37         ` Oliver Neukum
2019-08-19 12:43           ` Andrey Konovalov
2019-08-19 13:09             ` Oliver Neukum
2019-08-19 13:18               ` Andrey Konovalov
2019-08-19 13:49                 ` Oliver Neukum
2019-08-19 15:40                   ` Andrey Konovalov
2019-08-20  9:01                     ` Oliver Neukum
2019-08-15 14:28 ` Oliver Neukum
2019-08-15 14:48   ` syzbot
2019-11-19 13:35 ` Andrey Konovalov

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git