syzbot


KASAN: invalid-free in gadget_ep0_complete

Status: closed as invalid on 2019/06/27 14:36
Subsystems: usb
[Documentation on labels]
First crash: 1764d, last: 1764d

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in gadget_ep0_complete+0x17b/0x560 drivers/usb/gadget/fuzzer/fuzzer.c:471

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-rc6+ #12
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __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_invalid_free+0x61/0xa0 mm/kasan/report.c:279
 __kasan_slab_free+0x162/0x180 mm/kasan/common.c:430
 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
 gadget_ep0_complete+0x17b/0x560 drivers/usb/gadget/fuzzer/fuzzer.c:471
 dummy_timer.cold+0x22a/0x3c0 drivers/usb/gadget/udc/dummy_hcd.c:1874
 call_timer_fn+0x15e/0x5e0 kernel/time/timer.c:1322
 expire_timers kernel/time/timer.c:1366 [inline]
 __run_timers kernel/time/timer.c:1685 [inline]
 __run_timers kernel/time/timer.c:1653 [inline]
 run_timer_softirq+0x597/0x1410 kernel/time/timer.c:1698
 __do_softirq+0x219/0x8b0 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x17c/0x1a0 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0xe2/0x480 arch/x86/kernel/apic/apic.c:1068
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:806
 </IRQ>
RIP: 0010:default_idle+0x28/0x2b0 arch/x86/kernel/process.c:581
Code: 00 00 41 56 41 55 41 54 55 53 65 44 8b 2d 60 93 92 7a 0f 1f 44 00 00 e8 e6 03 d3 fb e9 07 00 00 00 0f 00 2d 5a 1f 53 00 fb f4 <65> 44 8b 2d 40 93 92 7a 0f 1f 44 00 00 5b 5d 41 5c 41 5d 41 5e c3
RSP: 0018:ffffffff86e07dc0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000007 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffffffff86e2b974
RBP: fffffbfff0dc5628 R08: ffffffff86e2b140 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff86e2b140
R13: 0000000000000000 R14: 0000000000000000 R15: ffffffff86e2b140
 cpuidle_idle_call kernel/sched/idle.c:154 [inline]
 do_idle+0x2de/0x380 kernel/sched/idle.c:263
 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:354
 start_kernel+0x7e0/0x81a init/main.c:761
 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

Allocated by task 5045:
 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
 slab_post_alloc_hook mm/slab.h:437 [inline]
 slab_alloc_node mm/slub.c:2748 [inline]
 slab_alloc mm/slub.c:2756 [inline]
 __kmalloc_track_caller+0xe2/0x2b0 mm/slub.c:4333
 memdup_user+0x22/0xb0 mm/util.c:164
 fuzzer_ioctl_ep0_write drivers/usb/gadget/fuzzer/fuzzer.c:880 [inline]
 fuzzer_ioctl+0x1ac/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 1751:
 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
 gadget_ep0_complete+0x17b/0x560 drivers/usb/gadget/fuzzer/fuzzer.c:471
 transfer drivers/usb/gadget/udc/dummy_hcd.c:1495 [inline]
 dummy_timer+0x162a/0x2df4 drivers/usb/gadget/udc/dummy_hcd.c:1949
 call_timer_fn+0x15e/0x5e0 kernel/time/timer.c:1322
 expire_timers kernel/time/timer.c:1366 [inline]
 __run_timers kernel/time/timer.c:1685 [inline]
 __run_timers kernel/time/timer.c:1653 [inline]
 run_timer_softirq+0x597/0x1410 kernel/time/timer.c:1698
 __do_softirq+0x219/0x8b0 kernel/softirq.c:292

The buggy address belongs to the object at ffff8881d3e3ee88
 which belongs to the cache kmalloc-8 of size 8
The buggy address is located 0 bytes inside of
 8-byte region [ffff8881d3e3ee88, ffff8881d3e3ee90)
The buggy address belongs to the page:
page:ffffea00074f8f80 refcount:1 mapcount:0 mapping:ffff8881dac03c00 index:0x0
flags: 0x200000000000200(slab)
raw: 0200000000000200 ffffea00074d0ac0 0000001200000012 ffff8881dac03c00
raw: 0000000000000000 0000000080aa00aa 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d3e3ed80: fb fc fc fb fc fc fb fc fc fb fc fc fb fc fc fb
 ffff8881d3e3ee00: fc fc fb fc fc fb fc fc fb fc fc fb fc fc fb fc
>ffff8881d3e3ee80: fc fb fc fc fb fc fc 00 fc fc fb fc fc 00 fc fc
                      ^
 ffff8881d3e3ef00: fb fc fc fb fc fc fb fc fc fb fc fc fb fc fc fb
 ffff8881d3e3ef80: fc fc fb fc fc fb fc fc fb fc fc fb 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/27 11:28 https://github.com/google/kasan.git usb-fuzzer 8e705694620d 7509bf36 .config console log report ci2-upstream-usb
* Struck through repros no longer work on HEAD.