================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x2dd6/0x3b30 kernel/locking/lockdep.c:5005 Read of size 8 at addr ffff888026429418 by task sshd/5196 CPU: 0 PID: 5196 Comm: sshd Not tainted 6.9.0-rc1-syzkaller-00274-g486291a0e624 #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+0x52/0xd0 arch/x86/kernel/irq.c:247 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:write_comp_data+0x0/0x90 kernel/kcov.c:230 Code: 48 8b 05 13 c9 75 7e 48 8b 80 08 16 00 00 c3 cc cc cc cc 0f 1f 80 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 <49> 89 d2 49 89 f8 49 89 f1 65 48 8b 15 df c8 75 7e 65 8b 05 e0 c8 RSP: 0018:ffffc900000070c8 EFLAGS: 00000206 RAX: 0000000000000000 RBX: 0000000000000003 RCX: ffffffff813c849e RDX: 0000000000000001 RSI: 0000000000000004 RDI: 0000000000000001 RBP: ffffffff8b09e1a0 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000006 R12: 0000000000000001 R13: 0000000000000001 R14: 0000000000000003 R15: 0000000000000001 __sanitizer_cov_trace_switch+0x54/0x90 kernel/kcov.c:341 unwind_next_frame+0xebe/0x23a0 arch/x86/kernel/unwind_orc.c:641 arch_stack_walk+0x100/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 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] kmem_cache_free+0x12e/0x380 mm/slub.c:4344 skb_kfree_head net/core/skbuff.c:1094 [inline] skb_kfree_head net/core/skbuff.c:1091 [inline] skb_free_head+0x19a/0x1e0 net/core/skbuff.c:1108 skb_release_data+0x76c/0x990 net/core/skbuff.c:1136 skb_release_all net/core/skbuff.c:1202 [inline] __kfree_skb+0x51/0x70 net/core/skbuff.c:1216 tcp_wmem_free_skb include/net/tcp.h:312 [inline] tcp_rtx_queue_unlink_and_free include/net/tcp.h:2098 [inline] tcp_clean_rtx_queue net/ipv4/tcp_input.c:3375 [inline] tcp_ack+0x1eb4/0x5ba0 net/ipv4/tcp_input.c:3967 tcp_rcv_established+0xda1/0x21b0 net/ipv4/tcp_input.c:6079 tcp_v4_do_rcv+0x6a9/0xa50 net/ipv4/tcp_ipv4.c:1906 tcp_v4_rcv+0x338b/0x3b40 net/ipv4/tcp_ipv4.c:2332 ip_protocol_deliver_rcu+0xba/0x4e0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x316/0x570 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_local_deliver+0x18e/0x1f0 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:460 [inline] ip_rcv_finish net/ipv4/ip_input.c:449 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_rcv+0x2c5/0x5d0 net/ipv4/ip_input.c:569 __netif_receive_skb_one_core+0x199/0x1e0 net/core/dev.c:5538 __netif_receive_skb+0x1d/0x160 net/core/dev.c:5652 process_backlog+0x12f/0x6f0 net/core/dev.c:5981 __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6632 napi_poll net/core/dev.c:6701 [inline] net_rx_action+0x9ad/0xf10 net/core/dev.c:6816 __do_softirq+0x218/0x922 kernel/softirq.c:554 do_softirq kernel/softirq.c:455 [inline] do_softirq+0xb2/0xf0 kernel/softirq.c:442 __local_bh_enable_ip+0x100/0x120 kernel/softirq.c:382 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:851 [inline] __dev_queue_xmit+0x879/0x3f20 net/core/dev.c:4362 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+0x16bf/0x2590 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/0x3da0 net/ipv4/tcp_output.c:1462 __tcp_send_ack.part.0+0x390/0x720 net/ipv4/tcp_output.c:4232 __tcp_send_ack net/ipv4/tcp_output.c:4238 [inline] tcp_send_ack+0x82/0xa0 net/ipv4/tcp_output.c:4238 __tcp_cleanup_rbuf+0x278/0x4b0 net/ipv4/tcp.c:1492 tcp_recvmsg_locked+0x1158/0x24d0 net/ipv4/tcp.c:2548 tcp_recvmsg+0x12e/0x680 net/ipv4/tcp.c:2578 inet_recvmsg+0x12b/0x6a0 net/ipv4/af_inet.c:883 sock_recvmsg_nosec net/socket.c:1046 [inline] sock_recvmsg+0x1b2/0x250 net/socket.c:1068 sock_read_iter+0x2c7/0x3c0 net/socket.c:1138 call_read_iter include/linux/fs.h:2102 [inline] new_sync_read fs/read_write.c:395 [inline] vfs_read+0x9fd/0xb80 fs/read_write.c:476 ksys_read+0x1f8/0x260 fs/read_write.c:619 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:0x7f1967116b6a Code: 00 3d 00 00 41 00 75 0d 50 48 8d 3d 2d 08 0a 00 e8 ea 7d 01 00 31 c0 e9 07 ff ff ff 64 8b 04 25 18 00 00 00 85 c0 75 1b 0f 05 <48> 3d 00 f0 ff ff 76 6c 48 8b 15 8f a2 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffd60cd78a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 0000000000008000 RCX: 00007f1967116b6a RDX: 0000000000008000 RSI: 000055dbc5f8bc90 RDI: 0000000000000007 RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 000055dbc5f857e0 R15: 000055dbc5f83e40 Allocated by task 5576: 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/0x11b0 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+0x6e1/0x1f10 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] __ia32_sys_mount+0x295/0x320 fs/namespace.c:3875 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x7a/0x120 arch/x86/entry/common.c:321 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:346 entry_SYSENTER_compat_after_hwframe+0x7f/0x89 Freed by task 5576: 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+0x9ca/0x11b0 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+0x6e1/0x1f10 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] __ia32_sys_mount+0x295/0x320 fs/namespace.c:3875 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x7a/0x120 arch/x86/entry/common.c:321 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:346 entry_SYSENTER_compat_after_hwframe+0x7f/0x89 The buggy address belongs to the object at ffff888026429400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff888026429400, ffff888026429600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x26428 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 ffff888014c42c80 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 head: 00fff80000000840 ffff888014c42c80 dead000000000122 0000000000000000 head: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 head: 00fff80000000002 ffffea0000990a01 ffffea0000990a48 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 5568, tgid 5567 (syz-executor.0), ts 65091216395, free_ts 63171151129 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+0x670/0x16d0 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] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc_node+0x36e/0x480 mm/slub.c:3973 kmalloc_array_node include/linux/slab.h:726 [inline] kcalloc_node include/linux/slab.h:731 [inline] memcg_alloc_slab_cgroups+0xa9/0x180 mm/memcontrol.c:3015 account_slab mm/slub.c:2301 [inline] allocate_slab mm/slub.c:2356 [inline] new_slab+0x2ed/0x3a0 mm/slub.c:2391 ___slab_alloc+0x670/0x16d0 mm/slub.c:3525 __kmem_cache_alloc_bulk mm/slub.c:4555 [inline] kmem_cache_alloc_bulk+0x27b/0x930 mm/slub.c:4629 io_refill_buffer_cache+0x294/0x4f0 io_uring/kbuf.c:438 io_add_buffers io_uring/kbuf.c:466 [inline] io_provide_buffers+0x681/0x1020 io_uring/kbuf.c:527 io_issue_sqe+0x177/0xdd0 io_uring/io_uring.c:1897 io_queue_sqe io_uring/io_uring.c:2106 [inline] io_submit_sqe io_uring/io_uring.c:2372 [inline] io_submit_sqes+0x975/0x1e50 io_uring/io_uring.c:2487 __do_sys_io_uring_enter+0x71d/0x1120 io_uring/io_uring.c:3663 page last free pid 5260 tgid 5260 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 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 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] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc+0x1bd/0x440 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] tomoyo_realpath_from_path+0xbf/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x2a7/0x3b0 security/tomoyo/file.c:771 tomoyo_file_open+0x71/0x90 security/tomoyo/tomoyo.c:334 security_file_open+0x78/0x630 security/security.c:2961 do_dentry_open+0x583/0x18c0 fs/open.c:942 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 Memory state around the buggy address: ffff888026429300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888026429380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888026429400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888026429480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888026429500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 48 8b 05 13 c9 75 7e mov 0x7e75c913(%rip),%rax # 0x7e75c91a 7: 48 8b 80 08 16 00 00 mov 0x1608(%rax),%rax e: c3 ret f: cc int3 10: cc int3 11: cc int3 12: cc int3 13: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) 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: 90 nop 23: 90 nop 24: 90 nop 25: 90 nop 26: 90 nop 27: 90 nop 28: 90 nop 29: 90 nop * 2a: 49 89 d2 mov %rdx,%r10 <-- trapping instruction 2d: 49 89 f8 mov %rdi,%r8 30: 49 89 f1 mov %rsi,%r9 33: 65 48 8b 15 df c8 75 mov %gs:0x7e75c8df(%rip),%rdx # 0x7e75c91a 3a: 7e 3b: 65 gs 3c: 8b .byte 0x8b 3d: 05 .byte 0x5 3e: e0 c8 loopne 0x8