BUG: KASAN: use-after-free in __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4925 Read of size 8 at addr ffff88804b9fd818 by task syz-executor.1/24798 CPU: 1 PID: 24798 Comm: syz-executor.1 Not tainted 6.1.0-rc4-syzkaller-00045-g1767a722a708 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbb/0x1f0 mm/kasan/report.c:495 __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4925 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:385 [inline] p9_req_put net/9p/client.c:393 [inline] p9_req_put+0xc6/0x250 net/9p/client.c:390 req_done+0x1de/0x2e0 net/9p/trans_virtio.c:148 vring_interrupt drivers/virtio/virtio_ring.c:2470 [inline] vring_interrupt+0x29d/0x3d0 drivers/virtio/virtio_ring.c:2445 __handle_irq_event_percpu+0x260/0x970 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0xa7/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0x9d/0x210 arch/x86/kernel/irq.c:250 common_interrupt+0xa4/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x22/0x40 arch/x86/include/asm/idtentry.h:640 RIP: 0010:lock_acquire+0x223/0x630 kernel/locking/lockdep.c:5636 Code: ae a2 7e 83 f8 01 0f 85 3a 03 00 00 9c 58 f6 c4 02 0f 85 25 03 00 00 48 83 7c 24 08 00 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 48 8b 84 24 RSP: 0018:ffffc90022e974c8 EFLAGS: 00000206 RAX: dffffc0000000000 RBX: 1ffff920045d2e9c RCX: 7439b744288dfca6 RDX: 1ffff11002940899 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff90932947 R10: fffffbfff2126528 R11: 0000000000000000 R12: 0000000000000002 R13: 0000000000000000 R14: ffffffff8bf88ac0 R15: 0000000000000000 rcu_lock_acquire include/linux/rcupdate.h:304 [inline] rcu_read_lock include/linux/rcupdate.h:738 [inline] folio_memcg_lock+0x3a/0x630 mm/memcontrol.c:2098 page_remove_rmap+0x27/0x1110 mm/rmap.c:1426 zap_pte_range mm/memory.c:1456 [inline] zap_pmd_range mm/memory.c:1577 [inline] zap_pud_range mm/memory.c:1606 [inline] zap_p4d_range mm/memory.c:1627 [inline] unmap_page_range+0x11ee/0x3c90 mm/memory.c:1648 unmap_single_vma+0x190/0x2a0 mm/memory.c:1694 unmap_vmas+0x21e/0x370 mm/memory.c:1733 exit_mmap+0x189/0x7a0 mm/mmap.c:3090 __mmput+0x128/0x4c0 kernel/fork.c:1185 mmput+0x5c/0x70 kernel/fork.c:1207 exit_mm kernel/exit.c:516 [inline] do_exit+0xa39/0x2a20 kernel/exit.c:807 do_group_exit+0xd0/0x2a0 kernel/exit.c:950 get_signal+0x21a1/0x2430 kernel/signal.c:2858 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:296 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7fad549 Code: Unable to access opcode bytes at 0xf7fad51f. RSP: 002b:00000000f7fa868c EFLAGS: 00000246 ORIG_RAX: 00000000000000f0 RAX: 0000000000000001 RBX: 00000000f737afcc RCX: 0000000000000081 RDX: 00000000000f4240 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 00000000f721afb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 24797: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa1/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:553 [inline] p9_client_create+0xaf/0x1070 net/9p/client.c:964 v9fs_session_init+0x1e2/0x1810 fs/9p/v9fs.c:408 v9fs_mount+0xba/0xc90 fs/9p/vfs_super.c:126 legacy_get_tree+0x105/0x220 fs/fs_context.c:610 vfs_get_tree+0x89/0x2f0 fs/super.c:1531 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1326/0x1e20 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __ia32_sys_mount+0x27e/0x300 fs/namespace.c:3568 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 24797: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2a/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0xab/0x3b0 mm/slub.c:3674 p9_client_create+0x7a6/0x1070 net/9p/client.c:1035 v9fs_session_init+0x1e2/0x1810 fs/9p/v9fs.c:408 v9fs_mount+0xba/0xc90 fs/9p/vfs_super.c:126 legacy_get_tree+0x105/0x220 fs/fs_context.c:610 vfs_get_tree+0x89/0x2f0 fs/super.c:1531 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1326/0x1e20 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __ia32_sys_mount+0x27e/0x300 fs/namespace.c:3568 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 The buggy address belongs to the object at ffff88804b9fd800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of 512-byte region [ffff88804b9fd800, ffff88804b9fda00) The buggy address belongs to the physical page: page:ffffea00012e7f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4b9fc head:ffffea00012e7f00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000010200 ffffea0001d4de00 dead000000000002 ffff888011842c80 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3713, tgid 3713 (syz-executor.0), ts 211673795119, free_ts 211670639951 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5555 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x191/0x3e0 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc+0x46/0xc0 mm/slab_common.c:968 kmalloc include/linux/slab.h:558 [inline] kzalloc include/linux/slab.h:689 [inline] new_dir fs/proc/proc_sysctl.c:971 [inline] get_subdir fs/proc/proc_sysctl.c:1015 [inline] __register_sysctl_table+0x9eb/0x10a0 fs/proc/proc_sysctl.c:1366 __devinet_sysctl_register+0x156/0x280 net/ipv4/devinet.c:2586 devinet_sysctl_register net/ipv4/devinet.c:2626 [inline] devinet_sysctl_register+0x160/0x230 net/ipv4/devinet.c:2616 inetdev_init+0x286/0x580 net/ipv4/devinet.c:279 inetdev_event+0xa85/0x1610 net/ipv4/devinet.c:1534 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] register_netdevice+0x10bb/0x1670 net/core/dev.c:10090 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3483 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x62/0x80 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] __kmem_cache_alloc_node+0x2da/0x3e0 mm/slub.c:3437 kmalloc_trace+0x22/0x60 mm/slab_common.c:1045 kmalloc include/linux/slab.h:553 [inline] kzalloc include/linux/slab.h:689 [inline] ref_tracker_alloc+0x14c/0x550 lib/ref_tracker.c:85 __netdev_tracker_alloc include/linux/netdevice.h:3995 [inline] netdev_hold include/linux/netdevice.h:4024 [inline] netdev_hold include/linux/netdevice.h:4019 [inline] netdev_queue_add_kobject net/core/net-sysfs.c:1663 [inline] netdev_queue_update_kobjects+0x1a7/0x4e0 net/core/net-sysfs.c:1718 register_queue_kobjects net/core/net-sysfs.c:1779 [inline] netdev_register_kobject+0x330/0x400 net/core/net-sysfs.c:2019 register_netdevice+0xd95/0x1670 net/core/dev.c:10057 veth_newlink+0x338/0x990 drivers/net/veth.c:1764 rtnl_newlink_create net/core/rtnetlink.c:3364 [inline] __rtnl_newlink+0x1087/0x17e0 net/core/rtnetlink.c:3581 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3594 rtnetlink_rcv_msg+0x43a/0xca0 net/core/rtnetlink.c:6091 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2540 Memory state around the buggy address: ffff88804b9fd700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88804b9fd780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88804b9fd800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804b9fd880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804b9fd900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: ae scas %es:(%rdi),%al 1: a2 7e 83 f8 01 0f 85 movabs %al,0x33a850f01f8837e 8: 3a 03 a: 00 00 add %al,(%rax) c: 9c pushfq d: 58 pop %rax e: f6 c4 02 test $0x2,%ah 11: 0f 85 25 03 00 00 jne 0x33c 17: 48 83 7c 24 08 00 cmpq $0x0,0x8(%rsp) 1d: 74 01 je 0x20 1f: fb sti 20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 27: fc ff df * 2a: 48 01 c3 add %rax,%rbx <-- trapping instruction 2d: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) 34: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx) 3b: 00 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 84 .byte 0x84 3f: 24 .byte 0x24