xpad 5-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 5-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in register_lock_class+0x101b/0x1230 kernel/locking/lockdep.c:1333 Read of size 1 at addr ffff8881159bf091 by task syz-executor.0/2510 CPU: 1 PID: 2510 Comm: syz-executor.0 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 register_lock_class+0x101b/0x1230 kernel/locking/lockdep.c:1333 __lock_acquire+0x112/0x3b30 kernel/locking/lockdep.c:5014 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/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:free_unref_page_commit+0x2df/0xd40 mm/page_alloc.c:2463 Code: 76 28 e9 6b f5 bf 04 0f bf fa 45 31 db 44 39 ef 7c 08 a8 01 0f 85 6e 05 00 00 83 c8 01 88 43 54 44 89 e8 c1 e0 05 39 c7 7d 2b <48> be 00 00 00 00 00 fc ff df 4c 89 c7 44 01 ca 48 c1 ef 03 0f b6 RSP: 0018:ffffc90001597998 EFLAGS: 00000297 RAX: 00000000000007e0 RBX: ffff8881f6741580 RCX: 0000000000000000 RDX: 0000000000000121 RSI: 0000000000000121 RDI: 0000000000000004 RBP: ffff8881f67415d4 R08: ffff8881f67415d8 R09: 0000000000000001 R10: 00000000ffffffff R11: 0000000000000000 R12: ffff88823fffaa00 R13: 000000000000003f R14: ffff8881f67415c0 R15: 0000000000000000 free_unref_page+0x1ef/0x2d0 mm/page_alloc.c:2509 vfree+0x181/0x7a0 mm/vmalloc.c:2842 kcov_put kernel/kcov.c:429 [inline] kcov_put+0x26/0x40 kernel/kcov.c:425 kcov_close+0x10/0x20 kernel/kcov.c:525 __fput+0x270/0xb70 fs/file_table.c:376 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa8a/0x2a50 kernel/exit.c:871 do_group_exit+0xd4/0x2a0 kernel/exit.c:1020 get_signal+0x23b5/0x2790 kernel/signal.c:2893 arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:105 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:201 [inline] syscall_exit_to_user_mode+0x144/0x250 kernel/entry/common.c:212 do_syscall_64+0xe0/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fb003814a0d Code: Unable to access opcode bytes at 0x7fb0038149e3. RSP: 002b:00007fff53258078 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: fffffffffffffe00 RBX: 0000000000000003 RCX: 00007fb003814a0d RDX: 0000000000000040 RSI: 00007fb003940020 RDI: 00000000000000f9 RBP: 00007fff532580dc R08: 00007fff532579ac R09: 00007fff53257dc7 R10: 00007fff53257a10 R11: 0000000000000246 R12: 0000000000000032 R13: 000000000003dc4b R14: 000000000003d5e3 R15: 0000000000000008 Allocated by task 44: 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 6273: 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 ffff8881159bf000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of freed 1024-byte region [ffff8881159bf000, ffff8881159bf400) The buggy address belongs to the physical page: page:ffffea0004566e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1159b8 head:ffffea0004566e00 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 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2363, tgid 2363 (init), ts 11018588615, free_ts 0 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_owner free stack trace missing Memory state around the buggy address: ffff8881159bef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881159bf000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881159bf080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881159bf100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881159bf180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 76 28 jbe 0x2a 2: e9 6b f5 bf 04 jmp 0x4bff572 7: 0f bf fa movswl %dx,%edi a: 45 31 db xor %r11d,%r11d d: 44 39 ef cmp %r13d,%edi 10: 7c 08 jl 0x1a 12: a8 01 test $0x1,%al 14: 0f 85 6e 05 00 00 jne 0x588 1a: 83 c8 01 or $0x1,%eax 1d: 88 43 54 mov %al,0x54(%rbx) 20: 44 89 e8 mov %r13d,%eax 23: c1 e0 05 shl $0x5,%eax 26: 39 c7 cmp %eax,%edi 28: 7d 2b jge 0x55 * 2a: 48 be 00 00 00 00 00 movabs $0xdffffc0000000000,%rsi <-- trapping instruction 31: fc ff df 34: 4c 89 c7 mov %r8,%rdi 37: 44 01 ca add %r9d,%edx 3a: 48 c1 ef 03 shr $0x3,%rdi 3e: 0f .byte 0xf 3f: b6 .byte 0xb6