================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x2dd6/0x3b30 kernel/locking/lockdep.c:5005 Read of size 8 at addr ffff8880217eb418 by task sshd/5179 CPU: 3 PID: 5179 Comm: sshd Not tainted 6.9.0-rc2-syzkaller-00002-g026e680b0a08 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 __lock_acquire+0x2dd6/0x3b30 kernel/locking/lockdep.c:5005 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 p9_tag_remove net/9p/client.c:394 [inline] p9_req_put net/9p/client.c:402 [inline] p9_req_put+0xca/0x250 net/9p/client.c:399 req_done+0x1e7/0x2f0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2595 [inline] vring_interrupt+0x31b/0x400 drivers/virtio/virtio_ring.c:2570 __handle_irq_event_percpu+0x229/0x7c0 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x263/0xd10 kernel/irq/chip.c:831 generic_handle_irq_desc include/linux/irqdesc.h:161 [inline] handle_irq arch/x86/kernel/irq.c:238 [inline] __common_interrupt+0xde/0x250 arch/x86/kernel/irq.c:257 common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:247 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:writel arch/x86/include/asm/io.h:66 [inline] RIP: 0010:e1000_xmit_frame+0x3295/0x4fb0 drivers/net/ethernet/intel/e1000/e1000_main.c:3274 Code: c1 ea 03 48 01 c3 48 b8 00 00 00 00 00 fc ff df 0f b6 04 02 84 c0 74 08 3c 03 0f 8e 3b 1b 00 00 48 8b 44 24 08 8b 40 18 89 03 f6 ea ff ff e8 91 91 61 fb 48 8d 6b 20 be 04 00 00 00 48 89 ef RSP: 0018:ffffc9000327ef88 EFLAGS: 00000246 RAX: 0000000000000022 RBX: ffffc900034e3818 RCX: ffffffff862be006 RDX: 1ffff110041eb993 RSI: ffffffff862be013 RDI: ffff888020f5ccaa RBP: 0000000000000022 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000006 R12: 00000000af100004 R13: ffff888020f5cc80 R14: ffff8880235f0000 R15: ffffc900000a9210 __netdev_start_xmit include/linux/netdevice.h:4903 [inline] netdev_start_xmit include/linux/netdevice.h:4917 [inline] xmit_one net/core/dev.c:3531 [inline] dev_hard_start_xmit+0x143/0x790 net/core/dev.c:3547 sch_direct_xmit+0x1ac/0xc20 net/sched/sch_generic.c:343 __dev_xmit_skb net/core/dev.c:3760 [inline] __dev_queue_xmit+0x12c3/0x3f20 net/core/dev.c:4301 dev_queue_xmit include/linux/netdevice.h:3091 [inline] neigh_hh_output include/net/neighbour.h:526 [inline] neigh_output include/net/neighbour.h:540 [inline] ip_finish_output2+0x16fc/0x25e0 net/ipv4/ip_output.c:235 __ip_finish_output net/ipv4/ip_output.c:313 [inline] __ip_finish_output+0x49e/0x950 net/ipv4/ip_output.c:295 ip_finish_output+0x31/0x310 net/ipv4/ip_output.c:323 NF_HOOK_COND include/linux/netfilter.h:303 [inline] ip_output+0x13b/0x2a0 net/ipv4/ip_output.c:433 dst_output include/net/dst.h:450 [inline] ip_local_out+0x33e/0x4a0 net/ipv4/ip_output.c:129 __ip_queue_xmit+0x747/0x1940 net/ipv4/ip_output.c:535 __tcp_transmit_skb+0x29c1/0x3dc0 net/ipv4/tcp_output.c:1462 tcp_transmit_skb net/ipv4/tcp_output.c:1480 [inline] tcp_write_xmit+0xfe0/0x7ee0 net/ipv4/tcp_output.c:2792 __tcp_push_pending_frames+0xaf/0x390 net/ipv4/tcp_output.c:2977 tcp_push+0x221/0x6f0 net/ipv4/tcp.c:738 tcp_sendmsg_locked+0x27b8/0x3480 net/ipv4/tcp.c:1310 tcp_sendmsg+0x2e/0x50 net/ipv4/tcp.c:1342 inet_sendmsg+0xb9/0x140 net/ipv4/af_inet.c:851 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_write_iter+0x4b8/0x5c0 net/socket.c:1160 call_write_iter include/linux/fs.h:2108 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6db/0x1100 fs/read_write.c:590 ksys_write+0x1f8/0x260 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x72/0x7a RIP: 0033:0x7ff7b8916bf2 Code: 89 c7 48 89 44 24 08 e8 7b 34 fa ff 48 8b 44 24 08 48 83 c4 28 c3 c3 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 6f 48 8b 15 07 a2 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007fff193f4838 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000002e14 RCX: 00007ff7b8916bf2 RDX: 0000000000002e14 RSI: 000055920343ea50 RDI: 0000000000000004 RBP: 00005592033cb3e0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00005591e992faa4 R13: 0000000000000133 R14: 00005591e99303e8 R15: 00007fff193f48a8 Allocated by task 13684: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc include/linux/slab.h:628 [inline] p9_client_create+0xcf/0x1210 net/9p/client.c:980 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa90 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1797 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x297/0x320 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x72/0x7a Freed by task 13684: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:240 [inline] __kasan_slab_free+0x11d/0x1a0 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+0x129/0x390 mm/slub.c:4390 p9_client_create+0xaaa/0x1210 net/9p/client.c:1051 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa90 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1797 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x297/0x320 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x72/0x7a The buggy address belongs to the object at ffff8880217eb400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff8880217eb400, ffff8880217eb600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x217e8 head: order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff80000000840(slab|head|node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 00fff80000000840 ffff888015442c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 head: 00fff80000000840 ffff888015442c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 head: 00fff80000000002 ffffea000085fa01 dead000000000122 00000000ffffffff head: 0000000400000000 0000000000000000 00000000ffffffff 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 9483, tgid 9483 (udevd), ts 197362961148, free_ts 197189059624 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2175 [inline] allocate_slab mm/slub.c:2338 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2391 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610 __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] kmalloc_trace+0x2fb/0x330 mm/slub.c:3992 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] kernfs_fop_open+0x28b/0xd40 fs/kernfs/file.c:623 do_dentry_open+0x8da/0x18c0 fs/open.c:955 do_open fs/namei.c:3642 [inline] path_openat+0x1dfb/0x2990 fs/namei.c:3799 do_filp_open+0x1dc/0x430 fs/namei.c:3826 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x72/0x7a page last free pid 4688 tgid 4688 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487 __folio_put_small mm/swap.c:119 [inline] __folio_put+0x166/0x1f0 mm/swap.c:142 folio_put include/linux/mm.h:1506 [inline] free_page_and_swap_cache+0x1eb/0x250 mm/swap_state.c:305 __tlb_remove_table arch/x86/include/asm/tlb.h:34 [inline] __tlb_remove_table_free mm/mmu_gather.c:227 [inline] tlb_remove_table_rcu+0x89/0xe0 mm/mmu_gather.c:282 rcu_do_batch kernel/rcu/tree.c:2196 [inline] rcu_core+0x828/0x16b0 kernel/rcu/tree.c:2471 __do_softirq+0x218/0x922 kernel/softirq.c:554 Memory state around the buggy address: ffff8880217eb300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880217eb380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880217eb400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880217eb480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880217eb500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: c1 ea 03 shr $0x3,%edx 3: 48 01 c3 add %rax,%rbx 6: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax d: fc ff df 10: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax 14: 84 c0 test %al,%al 16: 74 08 je 0x20 18: 3c 03 cmp $0x3,%al 1a: 0f 8e 3b 1b 00 00 jle 0x1b5b 20: 48 8b 44 24 08 mov 0x8(%rsp),%rax 25: 8b 40 18 mov 0x18(%rax),%eax 28: 89 03 mov %eax,(%rbx) * 2a: e9 f6 ea ff ff jmp 0xffffeb25 <-- trapping instruction 2f: e8 91 91 61 fb call 0xfb6191c5 34: 48 8d 6b 20 lea 0x20(%rbx),%rbp 38: be 04 00 00 00 mov $0x4,%esi 3d: 48 89 ef mov %rbp,%rdi