syzbot


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

Status: closed as invalid on 2019/06/26 11:36
Subsystems: usb
[Documentation on labels]
First crash: 1762d, last: 1762d
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 usb 1 1822d 1821d 0/26 closed as invalid on 2019/04/24 14:25

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in gadget_ep0_complete+0x4b3/0x550 drivers/usb/gadget/fuzzer/fuzzer.c:469
Read of size 8 at addr ffff8881ca50e010 by task kworker/1:4/2807

CPU: 1 PID: 2807 Comm: kworker/1:4 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+0x4b3/0x550 drivers/usb/gadget/fuzzer/fuzzer.c:469
 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
 worker_thread+0x96/0xe20 kernel/workqueue.c:2415
 kthread+0x30b/0x410 kernel/kthread.c:255
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 5805:
 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]
 dummy_alloc_request+0x86/0x130 drivers/usb/gadget/udc/dummy_hcd.c:661
 usb_ep_alloc_request+0x61/0x2c0 drivers/usb/gadget/udc/core.c:167
 gadget_bind+0xd8/0x290 drivers/usb/gadget/fuzzer/fuzzer.c:495
 udc_bind_to_driver+0x239/0x517 drivers/usb/gadget/udc/core.c:1347
 usb_gadget_probe_driver.cold+0x10/0xde drivers/usb/gadget/udc/core.c:1408
 fuzzer_ioctl_run drivers/usb/gadget/fuzzer/fuzzer.c:794 [inline]
 fuzzer_ioctl+0x158f/0x1d50 drivers/usb/gadget/fuzzer/fuzzer.c:1205
 full_proxy_unlocked_ioctl+0x111/0x180 fs/debugfs/file.c:205
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0xcda/0x12e0 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/0x560 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 5804:
 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
 dummy_free_request+0x52/0x80 drivers/usb/gadget/udc/dummy_hcd.c:679
 dev_put drivers/usb/gadget/fuzzer/fuzzer.c:222 [inline]
 dev_put+0x192/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 ffff8881ca50e000
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 16 bytes inside of
 128-byte region [ffff8881ca50e000, ffff8881ca50e080)
The buggy address belongs to the page:
page:ffffea0007294380 refcount:1 mapcount:0 mapping:ffff8881dac03200 index:0x0
flags: 0x200000000000200(slab)
raw: 0200000000000200 ffffea000765ec00 0000000e00000009 ffff8881dac03200
raw: 0000000000000000 0000000000150015 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881ca50df00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881ca50df80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881ca50e000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8881ca50e080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8881ca50e100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/06/23 07:58 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.