syzbot


KASAN: use-after-free Read in gadget_ep0_complete

Status: closed as invalid on 2019/04/24 14:25
Subsystems: usb
[Documentation on labels]
First crash: 1827d, last: 1827d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in gadget_ep0_complete (2) usb 1 1767d 1767d 0/26 closed as invalid on 2019/06/26 11:36

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
BUG: KASAN: use-after-free in do_raw_spin_lock+0x252/0x290 kernel/locking/spinlock_debug.c:112
Read of size 4 at addr ffff88806f3e000c by task kworker/1:4/5546

CPU: 1 PID: 5546 Comm: kworker/1:4 Not tainted 5.1.0-rc5-319617-gd34f951 #5
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+0xe8/0x16e lib/dump_stack.c:113
 print_address_description+0x6c/0x236 mm/kasan/report.c:187
 kasan_report.cold+0x1a/0x3c mm/kasan/report.c:317
 debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
 do_raw_spin_lock+0x252/0x290 kernel/locking/spinlock_debug.c:112
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:117 [inline]
 _raw_spin_lock_irqsave+0x4c/0x60 kernel/locking/spinlock.c:152
 gadget_ep0_complete+0x4b/0x150 drivers/usb/gadget/fuzzer/fuzzer.c:428
 nuke+0x16b/0x250 drivers/usb/gadget/udc/dummy_hcd.c:338
 stop_activity drivers/usb/gadget/udc/dummy_hcd.c:355 [inline]
 set_link_state+0x4c7/0xd00 drivers/usb/gadget/udc/dummy_hcd.c:459
 dummy_hub_control+0x8df/0x1d90 drivers/usb/gadget/udc/dummy_hcd.c:2292
 rh_call_control drivers/usb/core/hcd.c:685 [inline]
 rh_urb_enqueue drivers/usb/core/hcd.c:844 [inline]
 usb_hcd_submit_urb+0xc0f/0x2180 drivers/usb/core/hcd.c:1652
 usb_submit_urb+0x6f1/0x1480 drivers/usb/core/urb.c:569
 usb_start_wait_urb+0x10d/0x4d0 drivers/usb/core/message.c:57
 usb_internal_control_msg drivers/usb/core/message.c:101 [inline]
 usb_control_msg+0x321/0x4a0 drivers/usb/core/message.c:152
 set_port_feature+0x6e/0x90 drivers/usb/core/hub.c:428
 hub_port_reset+0x20d/0x1770 drivers/usb/core/hub.c:2871
 hub_port_init+0x937/0x2d30 drivers/usb/core/hub.c:4688
 hub_port_connect drivers/usb/core/hub.c:5021 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5204 [inline]
 port_event drivers/usb/core/hub.c:5350 [inline]
 hub_event+0x11c2/0x3b00 drivers/usb/core/hub.c:5432
 process_one_work+0x90f/0x1580 kernel/workqueue.c:2269
 process_scheduled_works kernel/workqueue.c:2331 [inline]
 worker_thread+0x7b0/0xe20 kernel/workqueue.c:2417
 kthread+0x313/0x420 kernel/kthread.c:253
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

Allocated by task 2778:
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:470
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 dev_new drivers/usb/gadget/fuzzer/fuzzer.c:194 [inline]
 fuzzer_open+0x48/0x390 drivers/usb/gadget/fuzzer/fuzzer.c:548
 full_proxy_open+0x461/0x750 fs/debugfs/file.c:293
 do_dentry_open+0x49c/0x1130 fs/open.c:777
 do_last fs/namei.c:3416 [inline]
 path_openat+0x147d/0x40b0 fs/namei.c:3533
 do_filp_open+0x1a6/0x280 fs/namei.c:3563
 do_sys_open+0x3c5/0x590 fs/open.c:1069
 do_syscall_64+0xcf/0x4f0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2777:
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x130/0x180 mm/kasan/common.c:459
 slab_free_hook mm/slub.c:1429 [inline]
 slab_free_freelist_hook+0x5e/0x140 mm/slub.c:1456
 slab_free mm/slub.c:3003 [inline]
 kfree+0xce/0x280 mm/slub.c:3958
 dev_put drivers/usb/gadget/fuzzer/fuzzer.c:232 [inline]
 dev_put+0x38f/0x4f0 drivers/usb/gadget/fuzzer/fuzzer.c:208
 fuzzer_release+0xf7/0x1e0 drivers/usb/gadget/fuzzer/fuzzer.c:600
 full_proxy_release+0x11c/0x2f0 fs/debugfs/file.c:239
 __fput+0x2df/0x8c0 fs/file_table.c:278
 task_work_run+0x149/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x8d0/0x2e10 kernel/exit.c:876
 do_group_exit+0x12a/0x350 kernel/exit.c:980
 get_signal+0x3a3/0x1cb0 kernel/signal.c:2577
 do_signal+0x86/0x1750 arch/x86/kernel/signal.c:816
 exit_to_usermode_loop+0x1fc/0x270 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x40c/0x4f0 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88806f3e0000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 12 bytes inside of
 2048-byte region [ffff88806f3e0000, ffff88806f3e0800)
The buggy address belongs to the page:
page:ffffea0001bcf800 count:1 mapcount:0 mapping:ffff88812c3f4800 index:0xffff88806f3e1100 compound_mapcount: 0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 ffff88812c3f6b80 ffffea0002023608 ffff88812c3f4800
raw: ffff88806f3e1100 00000000000f000a 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88806f3dff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88806f3dff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88806f3e0000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88806f3e0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88806f3e0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/24 09:47 https://github.com/google/kasan.git usb-fuzzer d34f9519daaa 8e3c52b1 .config console log report ci2-upstream-usb
* Struck through repros no longer work on HEAD.