BUG: KASAN: use-after-free in __lock_acquire+0x3ee7/0x56d0 kernel/locking/lockdep.c:4925 Read of size 8 at addr ffff888021aa6418 by task syz-executor.3/9446 CPU: 0 PID: 9446 Comm: syz-executor.3 Not tainted 6.1.0-rc4-syzkaller-00294-geb037f16f7e8 #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/0x461 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:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:194 Code: 74 24 10 e8 2a 0f cd f7 48 89 ef e8 72 7b cd f7 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 63 11 c0 f7 65 8b 05 ac 96 70 76 85 c0 74 0a 5b 5d c3 e8 f0 72 RSP: 0018:ffffc9000c06f780 EFLAGS: 00000206 RAX: 0000000000000006 RBX: 0000000000000200 RCX: 1ffffffff212dc9e RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff888021f916c0 R08: 0000000000000001 R09: ffffffff9092a9f7 R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000 R13: 0000000000000010 R14: 0000000000000001 R15: 0000000000000246 spin_unlock_irqrestore include/linux/spinlock.h:405 [inline] __wake_up_common_lock+0xde/0x130 kernel/sched/wait.c:139 __unix_dgram_recvmsg+0x2cd/0xb80 net/unix/af_unix.c:2465 unix_dgram_recvmsg+0xc0/0xe0 net/unix/af_unix.c:2535 sock_recvmsg_nosec net/socket.c:995 [inline] ____sys_recvmsg+0x53c/0x610 net/socket.c:2699 ___sys_recvmsg+0xf2/0x180 net/socket.c:2743 do_recvmmsg+0x25e/0x6e0 net/socket.c:2837 __sys_recvmmsg net/socket.c:2916 [inline] __do_sys_recvmmsg net/socket.c:2939 [inline] __se_sys_recvmmsg net/socket.c:2932 [inline] __x64_sys_recvmmsg+0x20b/0x260 net/socket.c:2932 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+0x63/0xcd RIP: 0033:0x7fa5ff28b639 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa5ffffb168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b RAX: ffffffffffffffda RBX: 00007fa5ff3ac050 RCX: 00007fa5ff28b639 RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00007fa5ff2e6a41 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdfe323e7f R14: 00007fa5ffffb300 R15: 0000000000022000 Allocated by task 9450: 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+0x9f/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] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 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+0x63/0xcd Freed by task 9450: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3585 [inline] __kmem_cache_free+0xc9/0x3a0 mm/slab.c:3592 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] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 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+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0x7b/0x90 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 ffff888021aa6400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of 512-byte region [ffff888021aa6400, ffff888021aa6600) The buggy address belongs to the physical page: page:ffffea000086a980 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888021aa6800 pfn:0x21aa6 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00006c4688 ffffea00009a6108 ffff888011840600 raw: ffff888021aa6800 ffff888021aa6000 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2c20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_THISNODE), pid 5946, tgid 5943 (syz-executor.0), ts 388125662106, free_ts 387630129808 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288 __alloc_pages_slowpath.constprop.0+0x36b/0x23d0 mm/page_alloc.c:5089 __alloc_pages+0x4a6/0x5a0 mm/page_alloc.c:5568 __alloc_pages_node include/linux/gfp.h:223 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x360 mm/slab.c:2570 cache_alloc_refill+0x27f/0x380 mm/slab.c:2943 ____cache_alloc mm/slab.c:3019 [inline] ____cache_alloc mm/slab.c:3002 [inline] __do_cache_alloc mm/slab.c:3202 [inline] slab_alloc_node mm/slab.c:3250 [inline] __kmem_cache_alloc_node+0x442/0x500 mm/slab.c:3549 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node_track_caller+0x47/0xc0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0xd9/0x2f0 net/core/skbuff.c:509 alloc_skb include/linux/skbuff.h:1267 [inline] nlmsg_new include/net/netlink.h:970 [inline] netlink_ack+0x389/0xd50 net/netlink/af_netlink.c:2490 netlink_rcv_skb+0x33d/0x420 net/netlink/af_netlink.c:2546 nfnetlink_rcv+0x1ac/0x420 net/netfilter/nfnetlink.c:659 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 sock_no_sendpage+0x108/0x150 net/core/sock.c:3219 kernel_sendpage.part.0+0x1d5/0x700 net/socket.c:3561 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 __folio_put_small mm/swap.c:105 [inline] __folio_put+0xc1/0x130 mm/swap.c:128 folio_put include/linux/mm.h:1159 [inline] put_page include/linux/mm.h:1211 [inline] free_page_and_swap_cache+0x253/0x2c0 mm/swap_state.c:299 __tlb_remove_table arch/x86/include/asm/tlb.h:34 [inline] __tlb_remove_table_free mm/mmu_gather.c:115 [inline] tlb_remove_table_rcu+0x85/0xe0 mm/mmu_gather.c:170 rcu_do_batch kernel/rcu/tree.c:2250 [inline] rcu_core+0x81f/0x1980 kernel/rcu/tree.c:2510 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 Memory state around the buggy address: ffff888021aa6300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888021aa6380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888021aa6400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888021aa6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021aa6500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 74 24 je 0x26 2: 10 e8 adc %ch,%al 4: 2a 0f sub (%rdi),%cl 6: cd f7 int $0xf7 8: 48 89 ef mov %rbp,%rdi b: e8 72 7b cd f7 callq 0xf7cd7b82 10: 81 e3 00 02 00 00 and $0x200,%ebx 16: 75 25 jne 0x3d 18: 9c pushfq 19: 58 pop %rax 1a: f6 c4 02 test $0x2,%ah 1d: 75 2d jne 0x4c 1f: 48 85 db test %rbx,%rbx 22: 74 01 je 0x25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 63 11 c0 f7 callq 0xf7c01192 <-- trapping instruction 2f: 65 8b 05 ac 96 70 76 mov %gs:0x767096ac(%rip),%eax # 0x767096e2 36: 85 c0 test %eax,%eax 38: 74 0a je 0x44 3a: 5b pop %rbx 3b: 5d pop %rbp 3c: c3 retq 3d: e8 .byte 0xe8 3e: f0 lock 3f: 72 .byte 0x72