xpad 3-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 3-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x265/0x2b0 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff88811cff985c by task syz-executor.0/6468 CPU: 1 PID: 6468 Comm: syz-executor.0 Not tainted 6.4.0-rc5-syzkaller-g18af4b5c9791 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x265/0x2b0 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x45/0x60 kernel/locking/spinlock.c:162 __wake_up_common_lock+0xb8/0x140 kernel/sched/wait.c:137 usb_anchor_resume_wakeups drivers/usb/core/urb.c:960 [inline] usb_anchor_resume_wakeups+0xc2/0xe0 drivers/usb/core/urb.c:953 __usb_hcd_giveback_urb+0x2e5/0x5c0 drivers/usb/core/hcd.c:1674 usb_hcd_giveback_urb+0x384/0x430 drivers/usb/core/hcd.c:1754 dummy_timer+0x13b6/0x3400 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers+0x29b/0x4b0 kernel/time/timer.c:1751 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035 __do_softirq+0x1c1/0x8e8 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu kernel/softirq.c:650 [inline] irq_exit_rcu+0x11b/0x190 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x92/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x70 kernel/kcov.c:200 Code: 76 e6 e8 00 66 0f 1f 44 00 00 f3 0f 1e fa 48 8b be a8 01 00 00 e8 b0 ff ff ff 31 c0 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 1e fa 65 8b 05 ed 82 b8 7e 89 c1 48 8b 34 24 81 e1 00 01 00 RSP: 0018:ffffc9000e1d7af8 EFLAGS: 00000293 RAX: 0000000000000000 RBX: 0000000000000200 RCX: 0000000000000000 RDX: ffff8881143b9d00 RSI: ffffffff812f77a5 RDI: 0000000000000007 RBP: ffffffff8811c338 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000200 R11: 205d383634365420 R12: 0000000000000000 R13: ffffffff8811c2e0 R14: dffffc0000000000 R15: 0000000000000001 console_emit_next_record arch/x86/include/asm/irqflags.h:42 [inline] console_flush_all+0x61b/0xcc0 kernel/printk/printk.c:2933 console_unlock+0xb8/0x1f0 kernel/printk/printk.c:3007 vprintk_emit+0x1bd/0x600 kernel/printk/printk.c:2307 vprintk+0x84/0xa0 kernel/printk/printk_safe.c:50 _printk+0xbf/0xf0 kernel/printk/printk.c:2328 usb_gadget_register_driver_owner+0x1c1/0x2b0 drivers/usb/gadget/udc/core.c:1597 raw_ioctl_run drivers/usb/gadget/legacy/raw_gadget.c:546 [inline] raw_ioctl+0x18e9/0x2a60 drivers/usb/gadget/legacy/raw_gadget.c:1253 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f4416b91117 Code: 3c 1c 48 f7 d8 49 39 c4 72 b8 e8 24 58 02 00 85 c0 78 bd 48 83 c4 08 4c 89 e0 5b 41 5c c3 0f 1f 44 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4415f02098 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f4415f03110 RCX: 00007f4416b91117 RDX: 0000000000000000 RSI: 0000000000005501 RDI: 0000000000000004 RBP: 0000000000000004 R08: 000000000000a8ff R09: 000000000000000b R10: 00007f4415f02140 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000020000800 R14: 00000000200004c0 R15: 0000000000000868 Allocated by task 5298: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x7b/0x90 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] xpad_probe+0x27b/0x1ed0 drivers/input/joystick/xpad.c:1976 usb_probe_interface+0x30f/0x960 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x240/0xca0 drivers/base/dd.c:658 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x112d/0x1a40 drivers/base/core.c:3625 usb_set_configuration+0x1196/0x1bc0 drivers/usb/core/message.c:2211 usb_generic_driver_probe+0xcf/0x130 drivers/usb/core/generic.c:238 usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x240/0xca0 drivers/base/dd.c:658 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x112d/0x1a40 drivers/base/core.c:3625 usb_new_device+0xcb2/0x19d0 drivers/usb/core/hub.c:2590 hub_port_connect drivers/usb/core/hub.c:5422 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x2e3d/0x4ed0 drivers/usb/core/hub.c:5808 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Freed by task 5234: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x144/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x99/0x320 mm/slub.c:3799 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2157 usb_unbind_interface+0x1dc/0x8e0 drivers/usb/core/driver.c:458 device_remove drivers/base/dd.c:569 [inline] device_remove+0x11f/0x170 drivers/base/dd.c:561 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x443/0x610 drivers/base/dd.c:1295 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574 device_del+0x399/0xa30 drivers/base/core.c:3814 usb_disable_device+0x360/0x7b0 drivers/usb/core/message.c:1420 usb_disconnect+0x2db/0x8a0 drivers/usb/core/hub.c:2253 hub_port_connect drivers/usb/core/hub.c:5261 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x2073/0x4ed0 drivers/usb/core/hub.c:5808 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 The buggy address belongs to the object at ffff88811cff9800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 92 bytes inside of freed 1024-byte region [ffff88811cff9800, ffff88811cff9c00) The buggy address belongs to the physical page: page:ffffea000473fe00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11cff8 head:ffffea000473fe00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x200000000010200(slab|head|node=0|zone=2) page_type: 0xffffffff() raw: 0200000000010200 ffff888100041dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2389, tgid 2389 (start-stop-daem), ts 16324672935, free_ts 16261049945 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x13a1/0x2aa0 mm/page_alloc.c:3502 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x390 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3192 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291 __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x291/0x2d0 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x4e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] load_elf_phdrs+0x103/0x210 fs/binfmt_elf.c:486 load_elf_binary+0x1db/0x4f40 fs/binfmt_elf.c:860 search_binary_handler fs/exec.c:1737 [inline] exec_binprm fs/exec.c:1779 [inline] bprm_execve fs/exec.c:1854 [inline] bprm_execve+0x7fd/0x1970 fs/exec.c:1810 do_execveat_common+0x72c/0x8e0 fs/exec.c:1962 do_execve fs/exec.c:2036 [inline] __do_sys_execve fs/exec.c:2112 [inline] __se_sys_execve fs/exec.c:2107 [inline] __x64_sys_execve+0x93/0xc0 fs/exec.c:2107 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x613/0xc80 mm/page_alloc.c:2564 free_unref_page+0x33/0x2a0 mm/page_alloc.c:2659 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2636 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x45/0x60 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:711 [inline] slab_alloc_node mm/slub.c:3451 [inline] __kmem_cache_alloc_node+0x185/0x2d0 mm/slub.c:3490 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x191/0x1f00 security/tomoyo/audit.c:255 tomoyo_supervisor+0x34e/0xec0 security/tomoyo/common.c:2088 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3a0 security/tomoyo/file.c:573 tomoyo_path_perm+0x31c/0x430 security/tomoyo/file.c:838 security_inode_getattr+0xd3/0x140 security/security.c:2114 vfs_getattr fs/stat.c:167 [inline] vfs_statx+0x16e/0x430 fs/stat.c:242 vfs_fstatat+0x90/0xb0 fs/stat.c:276 __do_sys_newfstatat+0x8a/0x110 fs/stat.c:446 Memory state around the buggy address: ffff88811cff9700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88811cff9780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88811cff9800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811cff9880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811cff9900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 76 e6 jbe 0xffffffe8 2: e8 00 66 0f 1f callq 0x1f0f6607 7: 44 00 00 add %r8b,(%rax) a: f3 0f 1e fa endbr64 e: 48 8b be a8 01 00 00 mov 0x1a8(%rsi),%rdi 15: e8 b0 ff ff ff callq 0xffffffca 1a: 31 c0 xor %eax,%eax 1c: c3 retq 1d: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1) 24: 00 00 00 00 28: 66 90 xchg %ax,%ax * 2a: f3 0f 1e fa endbr64 <-- trapping instruction 2e: 65 8b 05 ed 82 b8 7e mov %gs:0x7eb882ed(%rip),%eax # 0x7eb88322 35: 89 c1 mov %eax,%ecx 37: 48 8b 34 24 mov (%rsp),%rsi 3b: 81 .byte 0x81 3c: e1 00 loope 0x3e 3e: 01 00 add %eax,(%rax)