xpad 2-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 2-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:86 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x26f/0x2b0 kernel/locking/spinlock_debug.c:115 Read of size 4 at addr ffff88811d8ea05c by task syz-executor.2/2516 CPU: 0 PID: 2516 Comm: syz-executor.2 Not tainted 6.8.0-rc6-syzkaller-00190-ga788e53c05ae #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] do_raw_spin_lock+0x26f/0x2b0 kernel/locking/spinlock_debug.c:115 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x50 kernel/locking/spinlock.c:162 __wake_up_common_lock kernel/sched/wait.c:105 [inline] __wake_up+0x1c/0x50 kernel/sched/wait.c:127 __usb_unanchor_urb drivers/usb/core/urb.c:156 [inline] usb_anchor_resume_wakeups+0xc2/0xe0 drivers/usb/core/urb.c:150 __usb_hcd_giveback_urb+0x384/0x5c0 drivers/usb/core/hcd.c:1651 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1731 dummy_timer+0x1415/0x3600 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x193/0x590 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x759/0xaa0 kernel/time/timer.c:2038 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2051 __do_softirq+0x20a/0x8c1 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu kernel/softirq.c:632 [inline] irq_exit_rcu+0xa7/0x110 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1076 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:__sanitizer_cov_trace_pc+0x59/0x60 kernel/kcov.c:225 Code: 82 10 15 00 00 83 f8 02 75 20 48 8b 8a 18 15 00 00 8b 92 14 15 00 00 48 8b 01 48 83 c0 01 48 39 d0 73 07 48 89 01 48 89 34 c1 66 0f 1f 44 00 00 f3 0f 1e fa 41 57 41 56 49 89 d6 41 55 41 54 RSP: 0018:ffffc900015ffe60 EFLAGS: 00000293 RAX: 0000000000000000 RBX: ffff88810f30f680 RCX: ffffffff81aa5873 RDX: ffff888135873a00 RSI: ffffffff854c22cd RDI: 0000000000000005 RBP: 0000000000000003 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000080000000 R11: 0000000000000000 R12: 1ffff920002bffce R13: ffff888122240b80 R14: dffffc0000000000 R15: 0000000000000006 __sys_socket_create include/linux/err.h:61 [inline] __sys_socket+0xad/0x260 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f4f15ea9be7 Code: f0 ff ff 77 06 c3 0f 1f 44 00 00 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 29 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff4c1b2918 EFLAGS: 00000202 ORIG_RAX: 0000000000000029 RAX: ffffffffffffffda RBX: 00007f4f15fa31a0 RCX: 00007f4f15ea9be7 RDX: 0000000000000006 RSI: 0000000000000001 RDI: 0000000000000002 RBP: 00007fff4c1b305c R08: 000000000000000a R09: 00007fff4c1b2d47 R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000005a R13: 0000000000015f34 R14: 0000000000000000 R15: 000000000000000e Allocated by task 8: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0x87/0x90 mm/kasan/common.c:389 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] xpad_probe+0x27e/0x1f40 drivers/input/joystick/xpad.c:2007 usb_probe_interface+0x307/0x9c0 drivers/usb/core/driver.c:399 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x117e/0x1aa0 drivers/base/core.c:3639 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2210 usb_generic_driver_probe+0xad/0x110 drivers/usb/core/generic.c:254 usb_probe_device+0xec/0x3e0 drivers/usb/core/driver.c:294 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x117e/0x1aa0 drivers/base/core.c:3639 usb_new_device+0xd90/0x1a10 drivers/usb/core/hub.c:2643 hub_port_connect drivers/usb/core/hub.c:5512 [inline] hub_port_connect_change drivers/usb/core/hub.c:5652 [inline] port_event drivers/usb/core/hub.c:5812 [inline] hub_event+0x2e62/0x4f40 drivers/usb/core/hub.c:5894 process_one_work+0x886/0x15d0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2787 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:243 Freed by task 4778: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:643 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x106/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x105/0x340 mm/slub.c:4409 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2188 usb_unbind_interface+0x1e5/0x960 drivers/usb/core/driver.c:461 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+0x44a/0x610 drivers/base/dd.c:1295 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574 device_del+0x39a/0xa50 drivers/base/core.c:3828 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1418 usb_disconnect+0x2e1/0x910 drivers/usb/core/hub.c:2296 hub_port_connect drivers/usb/core/hub.c:5352 [inline] hub_port_connect_change drivers/usb/core/hub.c:5652 [inline] port_event drivers/usb/core/hub.c:5812 [inline] hub_event+0x1be0/0x4f40 drivers/usb/core/hub.c:5894 process_one_work+0x886/0x15d0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2787 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:243 The buggy address belongs to the object at ffff88811d8ea000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 92 bytes inside of freed 1024-byte region [ffff88811d8ea000, ffff88811d8ea400) The buggy address belongs to the physical page: page:ffffea0004763a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11d8e8 head:ffffea0004763a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x200000000000840(slab|head|node=0|zone=2) page_type: 0xffffffff() raw: 0200000000000840 ffff888100041dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2437, tgid 2437 (dhcpcd), ts 15455779771, free_ts 15435774560 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x139c/0x3470 mm/page_alloc.c:3311 __alloc_pages+0x228/0x2250 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2190 [inline] allocate_slab mm/slub.c:2354 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2407 ___slab_alloc+0x4b0/0x1860 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc+0x371/0x400 mm/slub.c:3994 kmalloc include/linux/slab.h:594 [inline] kzalloc include/linux/slab.h:711 [inline] tomoyo_init_log+0x1435/0x2110 security/tomoyo/audit.c:275 tomoyo_supervisor+0x30c/0xea0 security/tomoyo/common.c:2089 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x18f/0x200 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0xef6/0x2020 security/tomoyo/domain.c:878 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:102 [inline] tomoyo_bprm_check_security+0x12b/0x1d0 security/tomoyo/tomoyo.c:92 security_bprm_check+0x6a/0xe0 security/security.c:1188 search_binary_handler fs/exec.c:1771 [inline] exec_binprm fs/exec.c:1825 [inline] bprm_execve fs/exec.c:1877 [inline] bprm_execve+0x649/0x1970 fs/exec.c:1853 do_execveat_common.isra.0+0x5cb/0x750 fs/exec.c:1984 do_execve fs/exec.c:2058 [inline] __do_sys_execve fs/exec.c:2134 [inline] __se_sys_execve fs/exec.c:2129 [inline] __x64_sys_execve+0x8c/0xb0 fs/exec.c:2129 page last free pid 2436 tgid 2436 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x504/0xae0 mm/page_alloc.c:2346 free_unref_page+0x33/0x2d0 mm/page_alloc.c:2486 __put_partials+0x14c/0x160 mm/slub.c:2922 qlink_free mm/kasan/quarantine.c:160 [inline] qlist_free_all+0x58/0x150 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x4a/0x70 mm/kasan/common.c:324 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc+0x1b8/0x400 mm/slub.c:3994 kmalloc include/linux/slab.h:594 [inline] tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x26f/0x450 security/tomoyo/file.c:822 security_inode_getattr+0xf1/0x150 security/security.c:2238 vfs_getattr fs/stat.c:173 [inline] vfs_fstat+0x4f/0xc0 fs/stat.c:198 vfs_fstatat+0x130/0x140 fs/stat.c:300 __do_sys_newfstatat+0x98/0x110 fs/stat.c:468 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b Memory state around the buggy address: ffff88811d8e9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88811d8e9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88811d8ea000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811d8ea080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811d8ea100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 10 15 00 00 83 f8 adc %dl,-0x77d0000(%rip) # 0xf8830006 6: 02 75 20 add 0x20(%rbp),%dh 9: 48 8b 8a 18 15 00 00 mov 0x1518(%rdx),%rcx 10: 8b 92 14 15 00 00 mov 0x1514(%rdx),%edx 16: 48 8b 01 mov (%rcx),%rax 19: 48 83 c0 01 add $0x1,%rax 1d: 48 39 d0 cmp %rdx,%rax 20: 73 07 jae 0x29 22: 48 89 01 mov %rax,(%rcx) 25: 48 89 34 c1 mov %rsi,(%rcx,%rax,8) * 29: c3 ret <-- trapping instruction 2a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 30: f3 0f 1e fa endbr64 34: 41 57 push %r15 36: 41 56 push %r14 38: 49 89 d6 mov %rdx,%r14 3b: 41 55 push %r13 3d: 41 54 push %r12