================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5012 Read of size 8 at addr ffff88801f0e8818 by task kvm-nx-lpage-re/29049 CPU: 1 PID: 29049 Comm: kvm-nx-lpage-re Not tainted 6.5.0-syzkaller-01207-g1c59d383390f #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+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5012 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 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+0xc6/0x250 net/9p/client.c:399 req_done+0x1e7/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt drivers/virtio/virtio_ring.c:2501 [inline] vring_interrupt+0x317/0x3f0 drivers/virtio/virtio_ring.c:2476 __handle_irq_event_percpu+0x22a/0x740 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+0x261/0xcf0 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+0x9f/0x220 arch/x86/kernel/irq.c:257 common_interrupt+0xa9/0xd0 arch/x86/kernel/irq.c:247 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:636 RIP: 0010:check_region_inline mm/kasan/generic.c:175 [inline] RIP: 0010:kasan_check_range+0x2b/0x190 mm/kasan/generic.c:187 Code: 0f 1f 00 48 85 f6 0f 84 48 01 00 00 48 89 f8 41 54 44 0f b6 c2 48 01 f0 55 53 0f 82 c6 00 00 00 48 b8 ff ff ff ff ff 7f ff ff <48> 39 f8 0f 83 b3 00 00 00 4c 8d 54 37 ff 48 89 fd 48 b8 00 00 00 RSP: 0018:ffffc900032ef8e0 EFLAGS: 00000282 RAX: ffff7fffffffffff RBX: ffffffff8c9b3590 RCX: ffffffff8a358856 RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffffffff8c9b3590 RBP: 1ffff9200065df25 R08: 0000000000000001 R09: fffffbfff19366b2 R10: ffffffff8c9b3597 R11: 0000000000000000 R12: 0000000000000003 R13: fffffbfff2410cc4 R14: ffffffff92086620 R15: ffffc900032ef988 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_long_try_cmpxchg_release include/linux/atomic/atomic-instrumented.h:4444 [inline] __mutex_unlock_slowpath+0x156/0x640 kernel/locking/mutex.c:924 synchronize_rcu_expedited+0x66f/0x7e0 kernel/rcu/tree_exp.h:1012 synchronize_rcu+0x2f5/0x3b0 kernel/rcu/tree.c:3539 rcu_sync_enter+0x121/0x320 kernel/rcu/sync.c:149 percpu_down_write+0x66/0x3b0 kernel/locking/percpu-rwsem.c:231 cgroup_attach_lock kernel/cgroup/cgroup.c:2406 [inline] cgroup_attach_lock+0x37/0x40 kernel/cgroup/cgroup.c:2402 cgroup_attach_task_all+0x2f/0x140 kernel/cgroup/cgroup-v1.c:62 kvm_vm_worker_thread+0xdf/0x6b0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:6156 kthread+0x33a/0x430 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Allocated by task 29048: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:582 [inline] p9_client_create+0xcf/0x1210 net/9p/client.c:978 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xcd0 fs/9p/vfs_super.c:123 legacy_get_tree+0x109/0x220 fs/fs_context.c:638 vfs_get_tree+0x8c/0x370 fs/super.c:1711 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 29048: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x10b/0x1e0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3814 p9_client_create+0xa14/0x1210 net/9p/client.c:1049 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xcd0 fs/9p/vfs_super.c:123 legacy_get_tree+0x109/0x220 fs/fs_context.c:638 vfs_get_tree+0x8c/0x370 fs/super.c:1711 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __ia32_sys_mount+0x291/0x310 fs/namespace.c:3861 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 insert_work+0x4a/0x330 kernel/workqueue.c:1556 __queue_work+0x5f5/0x1040 kernel/workqueue.c:1717 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x585/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x218/0x965 kernel/softirq.c:553 Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 insert_work+0x4a/0x330 kernel/workqueue.c:1556 __queue_work+0x5f5/0x1040 kernel/workqueue.c:1717 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x585/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x218/0x965 kernel/softirq.c:553 The buggy address belongs to the object at ffff88801f0e8800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff88801f0e8800, ffff88801f0e8a00) The buggy address belongs to the physical page: page:ffffea00007c3a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f0e8 head:ffffea00007c3a00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012842c80 ffffea0000ab0800 dead000000000002 raw: 0000000000000000 0000000080100010 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 5193, tgid 5193 (syz-executor.1), ts 161066769349, free_ts 160822467504 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x24e/0x380 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc+0x4c/0x100 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:703 [inline] fib6_info_alloc+0x40/0x100 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x337/0x1b70 net/ipv6/route.c:3747 ip6_route_add+0x26/0x150 net/ipv6/route.c:3841 addrconf_add_mroute+0x1e0/0x350 net/ipv6/addrconf.c:2488 addrconf_add_dev+0x159/0x1d0 net/ipv6/addrconf.c:2506 inet6_addr_add+0x1a8/0xa20 net/ipv6/addrconf.c:2942 inet6_rtm_newaddr+0xf7d/0x19c0 net/ipv6/addrconf.c:4938 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443 free_zbud_page mm/zbud.c:148 [inline] zbud_free mm/zbud.c:330 [inline] zbud_zpool_free+0x1e3/0x460 mm/zbud.c:400 zswap_free_entry+0x305/0x480 mm/zswap.c:384 zswap_entry_put mm/zswap.c:409 [inline] zswap_entry_put mm/zswap.c:401 [inline] zswap_invalidate_entry mm/zswap.c:613 [inline] zswap_frontswap_invalidate_page+0x21c/0x2a0 mm/zswap.c:1500 __frontswap_invalidate_page+0xb8/0x160 mm/frontswap.c:244 frontswap_invalidate_page include/linux/frontswap.h:82 [inline] swap_range_free+0x311/0x420 mm/swapfile.c:749 swap_entry_free mm/swapfile.c:1322 [inline] swapcache_free_entries+0x25d/0x3d0 mm/swapfile.c:1433 free_swap_slot+0x284/0x340 mm/swap_slots.c:291 put_swap_folio+0x2a3/0x850 mm/swapfile.c:1379 delete_from_swap_cache+0xaf/0x180 mm/swap_state.c:243 folio_free_swap+0x2a1/0x360 mm/swapfile.c:1590 __try_to_reclaim_swap+0x2bf/0x400 mm/swapfile.c:153 scan_swap_map_slots+0xfee/0x18b0 mm/swapfile.c:902 get_swap_pages+0x469/0x9f0 mm/swapfile.c:1098 refill_swap_slots_cache mm/swap_slots.c:266 [inline] folio_alloc_swap+0x39e/0x6d0 mm/swap_slots.c:334 Memory state around the buggy address: ffff88801f0e8700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88801f0e8780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88801f0e8800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801f0e8880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801f0e8900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 0f 1f 00 nopl (%rax) 3: 48 85 f6 test %rsi,%rsi 6: 0f 84 48 01 00 00 je 0x154 c: 48 89 f8 mov %rdi,%rax f: 41 54 push %r12 11: 44 0f b6 c2 movzbl %dl,%r8d 15: 48 01 f0 add %rsi,%rax 18: 55 push %rbp 19: 53 push %rbx 1a: 0f 82 c6 00 00 00 jb 0xe6 20: 48 b8 ff ff ff ff ff movabs $0xffff7fffffffffff,%rax 27: 7f ff ff * 2a: 48 39 f8 cmp %rdi,%rax <-- trapping instruction 2d: 0f 83 b3 00 00 00 jae 0xe6 33: 4c 8d 54 37 ff lea -0x1(%rdi,%rsi,1),%r10 38: 48 89 fd mov %rdi,%rbp 3b: 48 rex.W 3c: b8 .byte 0xb8 3d: 00 00 add %al,(%rax)