================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x2de0/0x3cb0 kernel/locking/lockdep.c:5007 Read of size 8 at addr ffff8880787fa418 by task kworker/0:4/5849 CPU: 0 UID: 0 PID: 5849 Comm: kworker/0:4 Not tainted 6.11.0-rc5-syzkaller-00057-g86987d84b968 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: wg-crypt-wg0 wg_packet_encrypt_worker Call Trace: <IRQ> __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 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+0x2de0/0x3cb0 kernel/locking/lockdep.c:5007 lock_acquire kernel/locking/lockdep.c:5759 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5724 __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:397 [inline] p9_req_put net/9p/client.c:405 [inline] p9_req_put+0xaf/0x250 net/9p/client.c:402 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:173 [inline] handle_irq arch/x86/kernel/irq.c:247 [inline] call_irq_handler arch/x86/kernel/irq.c:259 [inline] __common_interrupt+0xdf/0x250 arch/x86/kernel/irq.c:285 common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:278 </IRQ> <TASK> asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:preempt_schedule_irq+0x4c/0x90 kernel/sched/core.c:6851 Code: df 55 65 48 8b 2d 54 06 fd 74 53 48 89 eb 48 c1 eb 03 48 01 c3 bf 01 00 00 00 e8 8f c3 54 f6 e8 3a 8c 8b f6 fb bf 01 00 00 00 <e8> 4f a3 ff ff 9c 58 fa f6 c4 02 75 1e bf 01 00 00 00 e8 bd 67 54 RSP: 0018:ffffc900207c72e8 EFLAGS: 00000202 RAX: 000000000012acd9 RBX: ffffed1002d75488 RCX: 1ffffffff28c409f RDX: 0000000000000000 RSI: ffffffff8b4cd060 RDI: 0000000000000001 RBP: ffff888016baa440 R08: 0000000000000001 R09: fffffbfff28b6b02 R10: ffffffff945b5817 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 irqentry_exit+0x36/0x90 kernel/entry/common.c:354 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:707 RIP: 0010:get_unaligned_le32 include/asm-generic/unaligned.h:32 [inline] RIP: 0010:chacha_load_key lib/crypto/chacha20poly1305.c:33 [inline] RIP: 0010:chacha20poly1305_crypt_sg_inplace+0x400/0xb50 lib/crypto/chacha20poly1305.c:239 Code: c2 84 c9 0f 95 c0 84 c2 0f 85 35 07 00 00 41 8b 47 18 49 8d 7f 1c 48 b9 00 00 00 00 00 fc ff df 89 84 24 e8 00 00 00 48 89 f8 <48> c1 e8 03 0f b6 14 08 49 8d 47 1f 48 89 c6 48 c1 ee 03 0f b6 0c RSP: 0018:ffffc900207c73b0 EFLAGS: 00000246 RAX: ffff88805780a03c RBX: dffffc0000000000 RCX: dffffc0000000000 RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff88805780a03c RBP: ffffc900207c7718 R08: 0000000000000007 R09: 000000007fffffff R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000075 R14: 0000000000000000 R15: ffff88805780a020 chacha20poly1305_encrypt_sg_inplace+0x3e/0x50 lib/crypto/chacha20poly1305.c:338 encrypt_packet+0x720/0x8e0 drivers/net/wireguard/send.c:216 wg_packet_encrypt_worker+0x2ec/0xb60 drivers/net/wireguard/send.c:297 process_one_work+0x958/0x1ad0 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK> Allocated by task 14000: 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_noprof include/linux/slab.h:681 [inline] p9_client_create+0xcf/0x11b0 net/9p/client.c:983 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa50 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3472 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3799 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount fs/namespace.c:3997 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:3997 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 14000: 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+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2252 [inline] slab_free mm/slub.c:4473 [inline] kfree+0x12a/0x3b0 mm/slub.c:4594 p9_client_create+0x9ca/0x11b0 net/9p/client.c:1054 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa50 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3472 [inline] path_mount+0x6e1/0x1f10 fs/namespace.c:3799 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount fs/namespace.c:3997 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:3997 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff8880787fa400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff8880787fa400, ffff8880787fa600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x787f8 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 04fff00000000040 ffff888015842c80 ffffea0001afea00 dead000000000002 raw: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 04fff00000000040 ffff888015842c80 ffffea0001afea00 dead000000000002 head: 0000000000000000 0000000080100010 00000001fdffffff 0000000000000000 head: 04fff00000000002 ffffea0001e1fe01 ffffffffffffffff 0000000000000000 head: 0000000000000004 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 13740, tgid 13732 (syz.1.2024), ts 698422727570, free_ts 698099890988 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3439 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4695 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x4e/0xf0 mm/slub.c:2321 allocate_slab mm/slub.c:2484 [inline] new_slab+0x84/0x260 mm/slub.c:2537 ___slab_alloc+0xdac/0x1870 mm/slub.c:3723 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3813 __slab_alloc_node mm/slub.c:3866 [inline] slab_alloc_node mm/slub.c:4025 [inline] __do_kmalloc_node mm/slub.c:4157 [inline] __kmalloc_noprof+0x379/0x410 mm/slub.c:4170 kmalloc_noprof include/linux/slab.h:685 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] copy_splice_read+0x1a8/0xb80 fs/splice.c:339 do_splice_read fs/splice.c:984 [inline] do_splice_read+0x2cf/0x380 fs/splice.c:959 splice_direct_to_actor+0x2a4/0xa40 fs/splice.c:1089 do_splice_direct_actor fs/splice.c:1207 [inline] do_splice_direct+0x17e/0x250 fs/splice.c:1233 do_sendfile+0xb1e/0xe50 fs/read_write.c:1295 __do_compat_sys_sendfile fs/read_write.c:1383 [inline] __se_compat_sys_sendfile fs/read_write.c:1366 [inline] __ia32_compat_sys_sendfile+0x1e7/0x230 fs/read_write.c:1366 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 page last free pid 13733 tgid 13732 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2612 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:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4044 ptlock_alloc+0x1f/0x70 mm/memory.c:6589 ptlock_init include/linux/mm.h:2940 [inline] pagetable_pte_ctor include/linux/mm.h:2967 [inline] __pte_alloc_one_noprof include/asm-generic/pgalloc.h:73 [inline] pte_alloc_one+0x74/0x370 arch/x86/mm/pgtable.c:33 __pte_alloc+0x6e/0x3a0 mm/memory.c:448 do_anonymous_page mm/memory.c:4523 [inline] do_pte_missing mm/memory.c:3945 [inline] handle_pte_fault mm/memory.c:5521 [inline] __handle_mm_fault+0x4e15/0x5350 mm/memory.c:5664 handle_mm_fault+0x44e/0x7b0 mm/memory.c:5832 faultin_page mm/gup.c:1194 [inline] __get_user_pages+0x475/0x15c0 mm/gup.c:1493 __get_user_pages_locked mm/gup.c:1760 [inline] __gup_longterm_locked+0x22e/0x1b30 mm/gup.c:2489 pin_user_pages_remote+0xee/0x150 mm/gup.c:3528 process_vm_rw_single_vec mm/process_vm_access.c:106 [inline] process_vm_rw_core.constprop.0+0x439/0x9f0 mm/process_vm_access.c:216 process_vm_rw+0x301/0x360 mm/process_vm_access.c:284 __do_sys_process_vm_readv mm/process_vm_access.c:296 [inline] __se_sys_process_vm_readv mm/process_vm_access.c:292 [inline] __ia32_sys_process_vm_readv+0xdf/0x1b0 mm/process_vm_access.c:292 Memory state around the buggy address: ffff8880787fa300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880787fa380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880787fa400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880787fa480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880787fa500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: df 55 65 fists 0x65(%rbp) 3: 48 8b 2d 54 06 fd 74 mov 0x74fd0654(%rip),%rbp # 0x74fd065e a: 53 push %rbx b: 48 89 eb mov %rbp,%rbx e: 48 c1 eb 03 shr $0x3,%rbx 12: 48 01 c3 add %rax,%rbx 15: bf 01 00 00 00 mov $0x1,%edi 1a: e8 8f c3 54 f6 call 0xf654c3ae 1f: e8 3a 8c 8b f6 call 0xf68b8c5e 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 4f a3 ff ff call 0xffffa37e <-- trapping instruction 2f: 9c pushf 30: 58 pop %rax 31: fa cli 32: f6 c4 02 test $0x2,%ah 35: 75 1e jne 0x55 37: bf 01 00 00 00 mov $0x1,%edi 3c: e8 .byte 0xe8 3d: bd .byte 0xbd 3e: 67 54 addr32 push %rsp