syzbot


KASAN: use-after-free Write in gadget_ep0_complete (2)

Status: closed as invalid on 2019/06/26 11:36
Subsystems: usb
[Documentation on labels]
First crash: 2255d, last: 2255d
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in gadget_ep0_complete usb 24 1 2320d 2320d 0/29 closed as invalid on 2019/04/18 12:35

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in gadget_ep0_complete+0x4c0/0x550 drivers/usb/gadget/fuzzer/fuzzer.c:470
Write of size 1 at addr ffff8881d5a94548 by task kworker/1:5/2936

CPU: 1 PID: 2936 Comm: kworker/1:5 Not tainted 5.2.0-rc5+ #11
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+0x67/0x231 mm/kasan/report.c:188
 __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:317
 kasan_report+0xe/0x20 mm/kasan/common.c:614
 gadget_ep0_complete+0x4c0/0x550 drivers/usb/gadget/fuzzer/fuzzer.c:470
 nuke+0x166/0x240 drivers/usb/gadget/udc/dummy_hcd.c:338
 stop_activity drivers/usb/gadget/udc/dummy_hcd.c:355 [inline]
 set_link_state+0x4c2/0xcf0 drivers/usb/gadget/udc/dummy_hcd.c:459
 dummy_hub_control+0xbfa/0x1670 drivers/usb/gadget/udc/dummy_hcd.c:2289
 rh_call_control drivers/usb/core/hcd.c:685 [inline]
 rh_urb_enqueue drivers/usb/core/hcd.c:844 [inline]
 usb_hcd_submit_urb+0xb93/0x1ee0 drivers/usb/core/hcd.c:1652
 usb_submit_urb+0x6e5/0x13b0 drivers/usb/core/urb.c:569
 usb_start_wait_urb+0x108/0x2b0 drivers/usb/core/message.c:57
 usb_internal_control_msg drivers/usb/core/message.c:101 [inline]
 usb_control_msg+0x31c/0x4a0 drivers/usb/core/message.c:152
 set_port_feature+0x69/0x90 drivers/usb/core/hub.c:428
 hub_port_reset+0x20a/0x1440 drivers/usb/core/hub.c:2871
 hub_port_init+0x9b0/0x2c00 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+0x18fd/0x3590 drivers/usb/core/hub.c:5432
 process_one_work+0x905/0x1570 kernel/workqueue.c:2269
 process_scheduled_works kernel/workqueue.c:2331 [inline]
 worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
 kthread+0x30b/0x410 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 4734:
 save_stack+0x1b/0x80 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:489 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:462
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 dev_new drivers/usb/gadget/fuzzer/fuzzer.c:195 [inline]
 fuzzer_open+0x43/0x390 drivers/usb/gadget/fuzzer/fuzzer.c:628
 full_proxy_open+0x459/0x740 fs/debugfs/file.c:293
 do_dentry_open+0x497/0x1040 fs/open.c:778
 do_last fs/namei.c:3416 [inline]
 path_openat+0x1430/0x3ff0 fs/namei.c:3533
 do_filp_open+0x1a1/0x280 fs/namei.c:3563
 do_sys_open+0x3c0/0x580 fs/open.c:1070
 do_syscall_64+0xb7/0x560 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4749:
 save_stack+0x1b/0x80 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x130/0x180 mm/kasan/common.c:451
 slab_free_hook mm/slub.c:1421 [inline]
 slab_free_freelist_hook mm/slub.c:1448 [inline]
 slab_free mm/slub.c:2994 [inline]
 kfree+0xd7/0x280 mm/slub.c:3949
 dev_put drivers/usb/gadget/fuzzer/fuzzer.c:233 [inline]
 dev_put+0x38a/0x4f0 drivers/usb/gadget/fuzzer/fuzzer.c:209
 fuzzer_release+0xf2/0x1d0 drivers/usb/gadget/fuzzer/fuzzer.c:681
 full_proxy_release+0x114/0x2e0 fs/debugfs/file.c:239
 __fput+0x2d7/0x790 fs/file_table.c:280
 task_work_run+0x13f/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x8cb/0x2d10 kernel/exit.c:877
 do_group_exit+0x125/0x350 kernel/exit.c:981
 get_signal+0x463/0x2380 kernel/signal.c:2640
 do_signal+0x88/0x1640 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop+0x195/0x1f0 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
 do_syscall_64+0x43f/0x560 arch/x86/entry/common.c:304
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8881d5a94400
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 328 bytes inside of
 2048-byte region [ffff8881d5a94400, ffff8881d5a94c00)
The buggy address belongs to the page:
page:ffffea000756a400 refcount:1 mapcount:0 mapping:ffff8881dac02800 index:0xffff8881d5a91980 compound_mapcount: 0
flags: 0x200000000010200(slab|head)
raw: 0200000000010200 ffffea0007261800 0000000500000005 ffff8881dac02800
raw: ffff8881d5a91980 00000000800f000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d5a94400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881d5a94480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881d5a94500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8881d5a94580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881d5a94600: 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/06/21 03:05 https://github.com/google/kasan.git usb-fuzzer 9939f56ee6c0 34bf9440 .config console log report ci2-upstream-usb
* Struck through repros no longer work on HEAD.