xpad 6-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 6-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in register_lock_class+0x8d1/0x980 kernel/locking/lockdep.c:1333 Read of size 1 at addr ffff88807f9a9091 by task udevd/4521 CPU: 1 PID: 4521 Comm: udevd Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #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+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 register_lock_class+0x8d1/0x980 kernel/locking/lockdep.c:1333 __lock_acquire+0xda/0x1fd0 kernel/locking/lockdep.c:5014 lock_acquire+0x1e4/0x530 kernel/locking/lockdep.c:5754 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 __wake_up_common_lock+0x25/0x1e0 kernel/sched/wait.c:105 __usb_hcd_giveback_urb+0x3ac/0x530 drivers/usb/core/hcd.c:1653 dummy_timer+0x8aa/0x3220 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x180/0x600 kernel/time/timer.c:1792 expire_timers kernel/time/timer.c:1843 [inline] __run_timers kernel/time/timer.c:2408 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2419 run_timer_base kernel/time/timer.c:2428 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2438 __do_softirq+0x2be/0x943 kernel/softirq.c:554 invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf2/0x1c0 kernel/softirq.c:633 irq_exit_rcu+0x9/0x30 kernel/softirq.c:645 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:get_current arch/x86/include/asm/current.h:49 [inline] RIP: 0010:__sanitizer_cov_trace_pc+0x8/0x70 kernel/kcov.c:206 Code: 8b 3d 6c 1c 1c 0c 48 89 de 5b e9 23 fb 57 00 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 8b 04 24 <65> 48 8b 0c 25 80 d0 03 00 65 8b 15 20 db 6e 7e f7 c2 00 01 ff 00 RSP: 0018:ffffc900030ef518 EFLAGS: 00000202 RAX: ffffffff8137272f RBX: ffffffff845d1650 RCX: ffff88807f373c00 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffffc900030ef5b0 R08: ffffffff8140ade5 R09: ffffffff8140a8df R10: 0000000000000003 R11: ffff88807f373c00 R12: ffff88807f373c00 R13: ffffffff8180e0a0 R14: ffffc900030ef600 R15: ffffc900030ef520 arch_stack_walk+0x15f/0x1b0 arch/x86/kernel/stacktrace.c:24 stack_trace_save+0x118/0x1d0 kernel/stacktrace.c:122 kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:3966 [inline] __kmalloc+0x233/0x4a0 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] kzalloc include/linux/slab.h:749 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x26f/0x540 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x59e/0x5e0 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x2b7/0x740 security/tomoyo/file.c:822 tomoyo_path_unlink+0xd0/0x110 security/tomoyo/tomoyo.c:162 security_path_unlink+0xe3/0x140 security/security.c:1851 do_unlinkat+0x3e6/0x830 fs/namei.c:4399 __do_sys_unlink fs/namei.c:4450 [inline] __se_sys_unlink fs/namei.c:4448 [inline] __x64_sys_unlink+0x49/0x60 fs/namei.c:4448 do_syscall_64+0xfd/0x240 entry_SYSCALL_64_after_hwframe+0x6d/0x75 RIP: 0033:0x7f495d577da7 Code: f0 ff ff 73 01 c3 48 8b 0d 7e 90 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 57 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 51 90 0d 00 f7 d8 64 89 01 48 RSP: 002b:00007fff3b709b28 EFLAGS: 00000202 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 00007f495d577da7 RDX: fffffffffffffe60 RSI: 00007fff3b709c00 RDI: 000055bf3909f0d8 RBP: 000000000000000b R08: 0000000000000007 R09: 8530d407468b236d R10: 4b78272ead7d185b R11: 0000000000000202 R12: 0000000000000bb8 R13: 0000000200000001 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 5278: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x1db/0x360 mm/slub.c:3997 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] xpad_probe+0x3c8/0x1b90 drivers/input/joystick/xpad.c:2013 usb_probe_interface+0x5cd/0xb00 drivers/usb/core/driver.c:399 really_probe+0x2a0/0xc50 drivers/base/dd.c:658 __driver_probe_device+0x1a2/0x3e0 drivers/base/dd.c:800 driver_probe_device+0x50/0x430 drivers/base/dd.c:830 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958 bus_for_each_drv+0x250/0x2e0 drivers/base/bus.c:457 __device_attach+0x333/0x520 drivers/base/dd.c:1030 bus_probe_device+0x189/0x260 drivers/base/bus.c:532 device_add+0x8ff/0xca0 drivers/base/core.c:3639 usb_set_configuration+0x1976/0x1fb0 drivers/usb/core/message.c:2207 usb_generic_driver_probe+0x88/0x140 drivers/usb/core/generic.c:254 usb_probe_device+0x140/0x2d0 drivers/usb/core/driver.c:294 really_probe+0x2a0/0xc50 drivers/base/dd.c:658 __driver_probe_device+0x1a2/0x3e0 drivers/base/dd.c:800 driver_probe_device+0x50/0x430 drivers/base/dd.c:830 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958 bus_for_each_drv+0x250/0x2e0 drivers/base/bus.c:457 __device_attach+0x333/0x520 drivers/base/dd.c:1030 bus_probe_device+0x189/0x260 drivers/base/bus.c:532 device_add+0x8ff/0xca0 drivers/base/core.c:3639 usb_new_device+0x104a/0x19a0 drivers/usb/core/hub.c:2614 hub_port_connect drivers/usb/core/hub.c:5483 [inline] hub_port_connect_change drivers/usb/core/hub.c:5623 [inline] port_event drivers/usb/core/hub.c:5783 [inline] hub_event+0x2d13/0x50f0 drivers/usb/core/hub.c:5865 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa02/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f2/0x390 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Freed by task 7: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x14a/0x380 mm/slub.c:4390 xpad_disconnect+0x359/0x490 drivers/input/joystick/xpad.c:2194 usb_unbind_interface+0x1d6/0x850 drivers/usb/core/driver.c:461 device_remove drivers/base/dd.c:569 [inline] __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x505/0x7c0 drivers/base/dd.c:1295 bus_remove_device+0x34f/0x420 drivers/base/bus.c:574 device_del+0x581/0xa30 drivers/base/core.c:3828 usb_disable_device+0x3bf/0x850 drivers/usb/core/message.c:1416 usb_disconnect+0x340/0x950 drivers/usb/core/hub.c:2267 hub_port_connect drivers/usb/core/hub.c:5323 [inline] hub_port_connect_change drivers/usb/core/hub.c:5623 [inline] port_event drivers/usb/core/hub.c:5783 [inline] hub_event+0x1e62/0x50f0 drivers/usb/core/hub.c:5865 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa02/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f2/0x390 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 The buggy address belongs to the object at ffff88807f9a9000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of freed 1024-byte region [ffff88807f9a9000, ffff88807f9a9400) The buggy address belongs to the physical page: page:ffffea0001fe6a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7f9a8 head:ffffea0001fe6a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888014c41dc0 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 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5091, tgid 5091 (syz-executor.4), ts 83148446237, free_ts 83073485202 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311 __alloc_pages+0x256/0x680 mm/page_alloc.c:4569 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x84/0x2f0 mm/slub.c:2391 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc_node_track_caller+0x2d6/0x4e0 mm/slub.c:3986 kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:599 __alloc_skb+0x1f3/0x440 net/core/skbuff.c:668 alloc_skb include/linux/skbuff.h:1318 [inline] nlmsg_new include/net/netlink.h:1010 [inline] inet6_rt_notify+0xdf/0x290 net/ipv6/route.c:6175 fib6_add_rt2node net/ipv6/ip6_fib.c:1261 [inline] fib6_add+0x1e33/0x4430 net/ipv6/ip6_fib.c:1487 __ip6_ins_rt net/ipv6/route.c:1313 [inline] ip6_route_add+0x8b/0x160 net/ipv6/route.c:3855 addrconf_prefix_route net/ipv6/addrconf.c:2483 [inline] fixup_permanent_addr net/ipv6/addrconf.c:3598 [inline] addrconf_permanent_addr+0x7c4/0xc50 net/ipv6/addrconf.c:3622 addrconf_notify+0x9f5/0x1020 net/ipv6/addrconf.c:3694 notifier_call_chain+0x191/0x3b0 kernel/notifier.c:93 __dev_notify_flags+0x207/0x400 page last free pid 5171 tgid 5171 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+0x968/0xa90 mm/page_alloc.c:2346 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486 discard_slab mm/slub.c:2437 [inline] __put_partials+0xeb/0x130 mm/slub.c:2906 put_cpu_partial+0x17c/0x250 mm/slub.c:2981 __slab_free+0x2ea/0x3d0 mm/slub.c:4151 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x174/0x340 mm/slub.c:3852 vm_area_dup+0x27/0x290 kernel/fork.c:482 __split_vma+0x1a9/0xd00 mm/mmap.c:2343 split_vma mm/mmap.c:2415 [inline] vma_modify+0x331/0x410 mm/mmap.c:2457 vma_modify_flags include/linux/mm.h:3283 [inline] mprotect_fixup+0x4a6/0xb80 mm/mprotect.c:635 do_mprotect_pkey+0x903/0xe20 mm/mprotect.c:809 __do_sys_mprotect mm/mprotect.c:830 [inline] __se_sys_mprotect mm/mprotect.c:827 [inline] __x64_sys_mprotect+0x80/0x90 mm/mprotect.c:827 do_syscall_64+0xfd/0x240 Memory state around the buggy address: ffff88807f9a8f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807f9a9000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807f9a9080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807f9a9100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807f9a9180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 8b 3d 6c 1c 1c 0c mov 0xc1c1c6c(%rip),%edi # 0xc1c1c72 6: 48 89 de mov %rbx,%rsi 9: 5b pop %rbx a: e9 23 fb 57 00 jmp 0x57fb32 f: 0f 1f 00 nopl (%rax) 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 90 nop 1f: 90 nop 20: 90 nop 21: 90 nop 22: f3 0f 1e fa endbr64 26: 48 8b 04 24 mov (%rsp),%rax * 2a: 65 48 8b 0c 25 80 d0 mov %gs:0x3d080,%rcx <-- trapping instruction 31: 03 00 33: 65 8b 15 20 db 6e 7e mov %gs:0x7e6edb20(%rip),%edx # 0x7e6edb5a 3a: f7 c2 00 01 ff 00 test $0xff0100,%edx