powermate: config urb returned -108 ================================================================== BUG: KASAN: use-after-free in perf_trace_lock_acquire+0x400/0x550 include/trace/events/lock.h:13 Read of size 8 at addr ffff88807deb3070 by task syz-executor.2/3636 CPU: 0 PID: 3636 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 perf_trace_lock_acquire+0x400/0x550 include/trace/events/lock.h:13 trace_lock_acquire include/trace/events/lock.h:13 [inline] lock_acquire+0x416/0x510 kernel/locking/lockdep.c:5610 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162 powermate_config_complete+0x79/0xb0 drivers/input/misc/powermate.c:202 __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1663 usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1733 dummy_timer+0x11f9/0x32b0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x67c/0xa30 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:tomoyo_check_acl+0xb0/0x450 security/tomoyo/domain.c:173 Code: 03 00 00 49 8b 5d 00 49 39 dd 0f 84 fa 01 00 00 e8 f5 f5 d4 fd 48 8d 7b 18 48 89 f8 48 89 fa 48 c1 e8 03 83 e2 07 0f b6 04 28 <38> d0 7f 08 84 c0 0f 85 f7 02 00 00 44 0f b6 73 18 31 ff 44 89 f6 RSP: 0018:ffffc900029cfa18 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffff88801932e600 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff83a2c53b RDI: ffff88801932e618 RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff83a2c5c1 R11: 0000000000000002 R12: ffffc900029cfb48 R13: ffff88807cdf8c90 R14: 0000000000000002 R15: 0000000000000000 tomoyo_path_permission security/tomoyo/file.c:586 [inline] tomoyo_path_permission+0x1ff/0x3a0 security/tomoyo/file.c:573 tomoyo_path_perm+0x2f0/0x400 security/tomoyo/file.c:838 security_inode_getattr+0xcf/0x140 security/security.c:1326 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x164/0x390 fs/stat.c:225 vfs_fstatat fs/stat.c:243 [inline] vfs_lstat include/linux/fs.h:3298 [inline] __do_sys_newlstat+0x91/0x110 fs/stat.c:398 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f1dc3c70f56 Code: ff ff ff 64 c7 00 16 00 00 00 b8 ff ff ff ff c3 0f 1f 40 00 41 89 f8 48 89 f7 48 89 d6 41 83 f8 01 77 29 b8 06 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 02 c3 90 48 c7 c2 bc ff ff ff f7 d8 64 89 02 RSP: 002b:00007f1dc42b7c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000006 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1dc3c70f56 RDX: 00007f1dc42b7cb0 RSI: 00007f1dc42b7cb0 RDI: 00007f1dc42b7d40 RBP: 00007f1dc42b7d40 R08: 0000000000000001 R09: 00007f1dc42b7b10 R10: 0000555555ada8e3 R11: 0000000000000246 R12: 00007f1dc3ccb1ea R13: 00007f1dc42b8e00 R14: 0000555555ada810 R15: 00007f1dc42b8e40 Allocated by task 3668: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc mm/kasan/common.c:516 [inline] ____kasan_kmalloc mm/kasan/common.c:475 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:716 [inline] powermate_probe+0x24a/0x12a0 drivers/input/misc/powermate.c:323 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xc17/0x1ee0 drivers/base/core.c:3409 usb_set_configuration+0x101e/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xc17/0x1ee0 drivers/base/core.c:3409 usb_new_device.cold+0x63f/0x108e drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5358 [inline] hub_port_connect_change drivers/usb/core/hub.c:5502 [inline] port_event drivers/usb/core/hub.c:5660 [inline] hub_event+0x2585/0x44d0 drivers/usb/core/hub.c:5742 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 26264: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:367 [inline] ____kasan_slab_free+0x130/0x160 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xcb/0x280 mm/slub.c:4562 powermate_disconnect+0x1ce/0x250 drivers/input/misc/powermate.c:432 usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1206 device_release_driver_internal drivers/base/dd.c:1237 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1260 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529 device_del+0x502/0xd50 drivers/base/core.c:3596 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2228 hub_quiesce+0x170/0x310 drivers/usb/core/hub.c:1330 hub_disconnect+0xcb/0x510 drivers/usb/core/hub.c:1725 usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1206 device_release_driver_internal drivers/base/dd.c:1237 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1260 usb_driver_release_interface+0x102/0x180 drivers/usb/core/driver.c:627 proc_disconnect_claim+0x217/0x380 drivers/usb/core/devio.c:2464 usbdev_do_ioctl drivers/usb/core/devio.c:2747 [inline] usbdev_ioctl+0x2b43/0x36c0 drivers/usb/core/devio.c:2791 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3591 drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1647 unregister_sysctl_table fs/proc/proc_sysctl.c:1685 [inline] unregister_sysctl_table+0xc0/0x190 fs/proc/proc_sysctl.c:1660 neigh_sysctl_unregister+0x5b/0x80 net/core/neighbour.c:3806 devinet_sysctl_unregister net/ipv4/devinet.c:2633 [inline] inetdev_destroy net/ipv4/devinet.c:326 [inline] inetdev_event+0xd01/0x15d0 net/ipv4/devinet.c:1600 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline] call_netdevice_notifiers net/core/dev.c:1945 [inline] unregister_netdevice_many+0x964/0x1850 net/core/dev.c:10409 sit_exit_batch_net+0x530/0x750 net/ipv6/sit.c:1950 ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Second to last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3026 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3106 ip_vs_app_inc_release net/netfilter/ipvs/ip_vs_app.c:140 [inline] unregister_ip_vs_app+0x2d5/0x540 net/netfilter/ipvs/ip_vs_app.c:242 __ip_vs_ftp_exit+0x48/0x60 net/netfilter/ipvs/ip_vs_ftp.c:611 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:168 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88807deb3000 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 112 bytes inside of 256-byte region [ffff88807deb3000, ffff88807deb3100) The buggy address belongs to the page: page:ffffea0001f7ac80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7deb2 head:ffffea0001f7ac80 order:1 compound_mapcount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea000068f680 dead000000000004 ffff888010c41b40 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3622, ts 58801576488, free_ts 58508693211 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2190 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x28a/0x3b0 mm/slub.c:2004 ___slab_alloc+0x87c/0xe90 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x2fb/0x340 mm/slub.c:4420 kmalloc include/linux/slab.h:587 [inline] kzalloc include/linux/slab.h:716 [inline] fib_create_info+0xd91/0x48e0 net/ipv4/fib_semantics.c:1454 fib_table_insert+0x1cd/0x1af0 net/ipv4/fib_trie.c:1224 fib_magic+0x455/0x540 net/ipv4/fib_frontend.c:1087 fib_add_ifaddr+0x16c/0x500 net/ipv4/fib_frontend.c:1109 fib_inetaddr_event+0x162/0x2a0 net/ipv4/fib_frontend.c:1420 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84 blocking_notifier_call_chain kernel/notifier.c:319 [inline] blocking_notifier_call_chain+0x67/0x90 kernel/notifier.c:307 __inet_insert_ifa+0x919/0xc20 net/ipv4/devinet.c:555 inet_rtm_newaddr+0xcb9/0x13c0 net/ipv4/devinet.c:958 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5e/0xf0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:738 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc_trace+0x1e9/0x2c0 mm/slub.c:3255 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:716 [inline] nsim_fib4_rt_create drivers/net/netdevsim/fib.c:277 [inline] nsim_fib4_rt_insert drivers/net/netdevsim/fib.c:423 [inline] nsim_fib4_event drivers/net/netdevsim/fib.c:461 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:881 [inline] nsim_fib_event_work+0x710/0x2490 drivers/net/netdevsim/fib.c:1477 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 process_scheduled_works kernel/workqueue.c:2370 [inline] worker_thread+0x833/0x1110 kernel/workqueue.c:2456 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88807deb2f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807deb2f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807deb3000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807deb3080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807deb3100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 00 00 add %al,(%rax) 2: 49 8b 5d 00 mov 0x0(%r13),%rbx 6: 49 39 dd cmp %rbx,%r13 9: 0f 84 fa 01 00 00 je 0x209 f: e8 f5 f5 d4 fd callq 0xfdd4f609 14: 48 8d 7b 18 lea 0x18(%rbx),%rdi 18: 48 89 f8 mov %rdi,%rax 1b: 48 89 fa mov %rdi,%rdx 1e: 48 c1 e8 03 shr $0x3,%rax 22: 83 e2 07 and $0x7,%edx 25: 0f b6 04 28 movzbl (%rax,%rbp,1),%eax * 29: 38 d0 cmp %dl,%al <-- trapping instruction 2b: 7f 08 jg 0x35 2d: 84 c0 test %al,%al 2f: 0f 85 f7 02 00 00 jne 0x32c 35: 44 0f b6 73 18 movzbl 0x18(%rbx),%r14d 3a: 31 ff xor %edi,%edi 3c: 44 89 f6 mov %r14d,%esi