================================================================== BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650 Read of size 1 at addr ffff888061ab80da by task kworker/0:4/5893 CPU: 0 UID: 0 PID: 5893 Comm: kworker/0:4 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650 dummy_timer+0x506/0x3840 drivers/usb/gadget/udc/dummy_hcd.c:1922 __run_hrtimer kernel/time/hrtimer.c:2079 [inline] __hrtimer_run_queues+0x448/0x9a0 kernel/time/hrtimer.c:2136 hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2153 handle_softirqs+0x216/0xa20 kernel/softirq.c:669 __do_softirq kernel/softirq.c:703 [inline] invoke_softirq kernel/softirq.c:542 [inline] __irq_exit_rcu+0x178/0x220 kernel/softirq.c:786 irq_exit_rcu+0x9/0x30 kernel/softirq.c:809 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 RIP: 0010:raw_spin_rq_unlock_irq kernel/sched/sched.h:1720 [inline] RIP: 0010:__schedule+0x30b1/0x6a40 kernel/sched/core.c:7394 Code: f0 fe ff ff e8 80 ed 98 f6 41 c7 87 20 0e 00 00 00 00 00 00 e9 a3 16 00 00 49 8d 7f 48 e8 37 f7 01 00 e8 62 e1 27 f6 fb 31 ff b5 e1 ff ff 49 8d bf c8 0e 00 00 48 b8 00 00 00 00 00 fc ff df RSP: 0000:ffffc9000612e900 EFLAGS: 00000246 RAX: 000000000000d443 RBX: 0000000000000000 RCX: 0000000000000040 RDX: 0000000000000001 RSI: ffffffff8e625f6d RDI: 0000000000000000 RBP: ffffc9000612ea60 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88802ae3d800 R13: ffff88802583cb00 R14: ffffffff8e8e1a10 R15: ffff88802ae3ca40 preempt_schedule_common kernel/sched/core.c:7568 [inline] preempt_schedule+0x57/0xd0 kernel/sched/core.c:7592 preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline] _raw_spin_unlock_irqrestore+0x61/0x80 kernel/locking/spinlock.c:221 __debug_object_init+0x2de/0x3d0 lib/debugobjects.c:810 timer_init_key_on_stack+0x2e/0x120 kernel/time/timer.c:817 cxacru_start_wait_urb+0xae/0x200 drivers/usb/atm/cxacru.c:597 cxacru_cm+0x410/0x9a0 drivers/usb/atm/cxacru.c:657 cxacru_card_status+0x21/0xf0 drivers/usb/atm/cxacru.c:762 cxacru_bind+0x882/0x1300 drivers/usb/atm/cxacru.c:1218 usbatm_usb_probe+0x378/0x1b50 drivers/usb/atm/usbatm.c:1059 cxacru_usb_probe+0x101/0x200 drivers/usb/atm/cxacru.c:1364 usb_probe_interface+0x386/0x980 drivers/usb/core/driver.c:399 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x241/0xa60 drivers/base/dd.c:707 __driver_probe_device+0x210/0x460 drivers/base/dd.c:869 driver_probe_device+0x4a/0x140 drivers/base/dd.c:899 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1027 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4c0 drivers/base/dd.c:1131 device_initial_probe+0xaf/0xf0 drivers/base/dd.c:1190 __bus_probe_device+0x60/0x160 drivers/base/bus.c:614 device_add+0x121d/0x1970 drivers/base/core.c:3778 usb_set_configuration+0xd97/0x1dc0 drivers/usb/core/message.c:2280 usb_generic_driver_probe+0xa1/0xe0 drivers/usb/core/generic.c:250 usb_probe_device+0xef/0x400 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x241/0xa60 drivers/base/dd.c:707 __driver_probe_device+0x210/0x460 drivers/base/dd.c:869 driver_probe_device+0x4a/0x140 drivers/base/dd.c:899 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1027 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4c0 drivers/base/dd.c:1131 device_initial_probe+0xaf/0xf0 drivers/base/dd.c:1190 __bus_probe_device+0x60/0x160 drivers/base/bus.c:614 device_add+0x121d/0x1970 drivers/base/core.c:3778 usb_new_device.part.0+0xcc2/0x1686 drivers/usb/core/hub.c:2713 usb_new_device include/linux/workqueue.h:715 [inline] hub_port_connect drivers/usb/core/hub.c:5585 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event.cold+0x1e3/0xe90 drivers/usb/core/hub.c:5971 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 9272: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5680 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] device_private_init drivers/base/core.c:3608 [inline] device_add+0xd3f/0x1970 drivers/base/core.c:3659 tty_register_device_attr+0x388/0x810 drivers/tty/tty_io.c:3254 gsm_register_devices drivers/tty/n_gsm.c:657 [inline] gsm_activate_mux+0x155/0x2a0 drivers/tty/n_gsm.c:3197 gsm_config drivers/tty/n_gsm.c:3442 [inline] gsmld_ioctl+0xbbc/0x15c0 drivers/tty/n_gsm.c:3845 tty_compat_ioctl+0x396/0x420 drivers/tty/tty_io.c:2972 __do_compat_sys_ioctl fs/ioctl.c:696 [inline] __se_compat_sys_ioctl fs/ioctl.c:639 [inline] __ia32_compat_sys_ioctl+0x2cf/0x360 fs/ioctl.c:639 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 9269: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2780 [inline] slab_free mm/slub.c:6630 [inline] kfree+0x22b/0x6d0 mm/slub.c:6923 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1f7/0x640 lib/kobject.c:737 put_device drivers/base/core.c:3886 [inline] device_unregister+0x2f/0xe0 drivers/base/core.c:4009 device_destroy+0x99/0xe0 drivers/base/core.c:4562 tty_unregister_device+0x82/0x1d0 drivers/tty/tty_io.c:3302 gsm_unregister_devices drivers/tty/n_gsm.c:693 [inline] gsm_cleanup_mux+0x5f6/0x890 drivers/tty/n_gsm.c:3155 gsmld_close+0x45/0x200 drivers/tty/n_gsm.c:3664 tty_ldisc_close+0x114/0x1a0 drivers/tty/tty_ldisc.c:455 tty_ldisc_kill+0x8e/0x150 drivers/tty/tty_ldisc.c:613 tty_ldisc_release+0x107/0x2f0 drivers/tty/tty_ldisc.c:781 tty_release_struct+0x23/0xe0 drivers/tty/tty_io.c:1656 tty_release+0xd7a/0x1300 drivers/tty/tty_io.c:1827 __fput+0x3fb/0xb50 fs/file_table.c:512 fput_close_sync+0x118/0x250 fs/file_table.c:618 filp_close_sync+0x75/0xa0 fs/open.c:1574 __range_close+0x4a6/0x8b0 fs/file.c:919 __do_sys_close_range fs/file.c:1003 [inline] __se_sys_close_range fs/file.c:954 [inline] __ia32_sys_close_range+0x1f8/0x430 fs/file.c:954 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888061ab8000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 218 bytes inside of freed 512-byte region [ffff888061ab8000, ffff888061ab8200) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888061ab9800 pfn:0x61ab8 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801d442c80 ffffea000184f210 ffffea0001841810 raw: ffff888061ab9800 000000000010000c 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d442c80 ffffea000184f210 ffffea0001841810 head: ffff888061ab9800 000000000010000c 00000000f5000000 0000000000000000 head: 04fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5787, tgid 5787 (syz-executor), ts 40785320694 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1860 prep_new_page mm/page_alloc.c:1868 [inline] get_page_from_freelist+0xdae/0x2c80 mm/page_alloc.c:3950 __alloc_frozen_pages_noprof+0x2ad/0x31e0 mm/page_alloc.c:5492 alloc_slab_page mm/slub.c:3384 [inline] allocate_slab mm/slub.c:3499 [inline] new_slab+0xb1/0x6d0 mm/slub.c:3550 refill_objects+0xe3/0x410 mm/slub.c:7539 refill_sheaf mm/slub.c:2917 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4811 alloc_from_pcs mm/slub.c:4887 [inline] slab_alloc_node mm/slub.c:5021 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_noprof+0x677/0x840 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] tomoyo_init_log+0x114d/0x1f80 security/tomoyo/audit.c:273 tomoyo_supervisor+0x506/0x1340 security/tomoyo/common.c:2232 tomoyo_audit_path_number_log security/tomoyo/file.c:239 [inline] tomoyo_path_number_perm+0x445/0x580 security/tomoyo/file.c:739 tomoyo_path_mkdir+0x9b/0xe0 security/tomoyo/tomoyo.c:179 security_path_mkdir+0x154/0x2e0 security/security.c:1465 filename_mkdirat+0x168/0x630 fs/namei.c:5458 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __ia32_sys_mkdirat+0x88/0xc0 fs/namei.c:5479 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311 page last free pid 5787 tgid 5787 ts 40775168212 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1402 [inline] __free_frozen_pages+0x7b1/0x10f0 mm/page_alloc.c:2958 stack_depot_save_flags+0x456/0xa10 lib/stackdepot.c:735 kasan_save_stack+0x3f/0x50 mm/kasan/common.c:58 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 unpoison_slab_object mm/kasan/common.c:351 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:377 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4720 [inline] slab_alloc_node mm/slub.c:5033 [inline] kmem_cache_alloc_noprof+0x269/0x6a0 mm/slub.c:5047 alloc_vfsmnt+0x25/0x840 fs/namespace.c:316 clone_mnt+0x4b/0x9c0 fs/namespace.c:1335 copy_tree+0x327/0xc50 fs/namespace.c:2270 __do_loopback+0x338/0x540 fs/namespace.c:3098 do_loopback fs/namespace.c:3129 [inline] path_mount+0x1ce8/0x2850 fs/namespace.c:4331 do_mount fs/namespace.c:4350 [inline] __do_sys_mount fs/namespace.c:4565 [inline] __se_sys_mount fs/namespace.c:4542 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4542 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff888061ab7f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888061ab8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888061ab8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888061ab8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888061ab8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 3 bytes skipped: 0: ff ljmp (bad) 1: e8 80 ed 98 f6 call 0xf698ed86 6: 41 c7 87 20 0e 00 00 movl $0x0,0xe20(%r15) d: 00 00 00 00 11: e9 a3 16 00 00 jmp 0x16b9 16: 49 8d 7f 48 lea 0x48(%r15),%rdi 1a: e8 37 f7 01 00 call 0x1f756 1f: e8 62 e1 27 f6 call 0xf627e186 24: fb sti 25: 31 ff xor %edi,%edi * 27: e9 b5 e1 ff ff jmp 0xffffe1e1 <-- trapping instruction 2c: 49 8d bf c8 0e 00 00 lea 0xec8(%r15),%rdi 33: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 3a: fc ff df