================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:132 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:166 Read of size 1 at addr ffff888056657418 by task kworker/u32:11/3760 CPU: 3 UID: 0 PID: 3760 Comm: kworker/u32:11 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: events_unbound toggle_allocation_gate Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1d0 mm/kasan/report.c:595 __kasan_check_byte+0x36/0x50 mm/kasan/common.c:574 kasan_check_byte include/linux/kasan.h:402 [inline] lock_acquire kernel/locking/lockdep.c:5842 [inline] lock_acquire+0x12a/0x370 kernel/locking/lockdep.c:5825 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:132 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:166 p9_tag_remove net/9p/client.c:274 [inline] p9_req_put net/9p/client.c:282 [inline] p9_req_put+0xaf/0x250 net/9p/client.c:279 req_done+0x1dc/0x2e0 net/9p/trans_virtio.c:147 vring_interrupt+0x2ef/0x650 drivers/virtio/virtio_ring.c:3254 __handle_irq_event_percpu+0x235/0x8c0 kernel/irq/handle.c:209 handle_irq_event_percpu kernel/irq/handle.c:246 [inline] handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:263 handle_edge_irq+0x35e/0x960 kernel/irq/chip.c:856 generic_handle_irq_desc include/linux/irqdesc.h:186 [inline] handle_irq arch/x86/kernel/irq.c:262 [inline] call_irq_handler arch/x86/kernel/irq.c:318 [inline] __common_interrupt+0xd8/0x2f0 arch/x86/kernel/irq.c:333 common_interrupt+0xb9/0xe0 arch/x86/kernel/irq.c:326 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:688 RIP: 0010:get_current arch/x86/include/asm/current.h:23 [inline] RIP: 0010:write_comp_data+0x10/0x90 kernel/kcov.c:245 Code: 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 65 8b 05 b9 1d 0a 12 49 89 f8 49 89 f1 49 89 d2 <65> 48 8b 3d 90 1d 0a 12 a9 00 01 ff 00 74 1b f6 c4 01 74 07 a9 00 RSP: 0018:ffffc90026f07868 EFLAGS: 00000202 RAX: 0000000000000001 RBX: 0000000000000001 RCX: ffffffff81fcf98d RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000005 RBP: ffff88806a5431a0 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000003 R13: ffffed100d4a8635 R14: 0000000000000001 R15: ffff88806a73c580 csd_lock_wait kernel/smp.c:342 [inline] smp_call_function_many_cond+0x5ad/0x1700 kernel/smp.c:892 on_each_cpu_cond_mask+0x40/0x90 kernel/smp.c:1057 on_each_cpu include/linux/smp.h:72 [inline] smp_text_poke_sync_each_cpu arch/x86/kernel/alternative.c:2773 [inline] smp_text_poke_batch_finish+0x337/0xc60 arch/x86/kernel/alternative.c:2983 arch_jump_label_transform_apply+0x1c/0x30 arch/x86/kernel/jump_label.c:146 jump_label_update+0x37a/0x550 kernel/jump_label.c:910 static_key_enable_cpuslocked+0x1bc/0x270 kernel/jump_label.c:210 static_key_enable+0x1a/0x20 kernel/jump_label.c:223 toggle_allocation_gate mm/kfence/core.c:906 [inline] toggle_allocation_gate+0xfe/0x2d0 mm/kfence/core.c:898 process_one_work+0xa0e/0x1980 kernel/workqueue.c:3302 process_scheduled_works kernel/workqueue.c:3385 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3466 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 9996: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kmalloc_noprof include/linux/slab.h:950 [inline] p9_client_create+0xaf/0xd40 net/9p/client.c:862 v9fs_session_init+0x40/0xce0 fs/9p/v9fs.c:442 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3758 [inline] do_new_mount fs/namespace.c:3834 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4154 do_mount fs/namespace.c:4167 [inline] __do_sys_mount fs/namespace.c:4383 [inline] __se_sys_mount fs/namespace.c:4360 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4360 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 9996: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2689 [inline] slab_free mm/slub.c:6246 [inline] kfree+0x223/0x6c0 mm/slub.c:6561 p9_client_create+0x72d/0xd40 net/9p/client.c:941 v9fs_session_init+0x40/0xce0 fs/9p/v9fs.c:442 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1754 fc_mount fs/namespace.c:1193 [inline] do_new_mount_fc fs/namespace.c:3758 [inline] do_new_mount fs/namespace.c:3834 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4154 do_mount fs/namespace.c:4167 [inline] __do_sys_mount fs/namespace.c:4383 [inline] __se_sys_mount fs/namespace.c:4360 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4360 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888056657400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff888056657400, ffff888056657600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x56654 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b842c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b842c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 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 5959, tgid 5959 (syz-executor), ts 63371818542, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1858 prep_new_page mm/page_alloc.c:1866 [inline] get_page_from_freelist+0x11a6/0x33b0 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5226 alloc_slab_page mm/slub.c:3278 [inline] allocate_slab mm/slub.c:3467 [inline] new_slab+0xa6/0x6c0 mm/slub.c:3525 refill_objects+0x277/0x420 mm/slub.c:7251 refill_sheaf mm/slub.c:2816 [inline] __pcs_replace_empty_main+0x375/0x650 mm/slub.c:4651 alloc_from_pcs mm/slub.c:4749 [inline] slab_alloc_node mm/slub.c:4883 [inline] __kmalloc_cache_noprof+0x493/0x6f0 mm/slub.c:5410 kmalloc_noprof include/linux/slab.h:950 [inline] kzalloc_noprof include/linux/slab.h:1188 [inline] device_private_init drivers/base/core.c:3536 [inline] device_add+0xd3a/0x1920 drivers/base/core.c:3587 device_create_groups_vargs+0x1f8/0x270 drivers/base/core.c:4373 device_create+0xed/0x130 drivers/base/core.c:4412 macvtap_device_event+0x301/0x3c0 drivers/net/macvtap.c:177 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2249 call_netdevice_notifiers_extack net/core/dev.c:2287 [inline] call_netdevice_notifiers net/core/dev.c:2301 [inline] register_netdevice+0x16e6/0x2210 net/core/dev.c:11508 macvlan_common_newlink+0xf70/0x18b0 drivers/net/macvlan.c:1554 macvtap_newlink drivers/net/macvtap.c:109 [inline] macvtap_newlink+0x17a/0x240 drivers/net/macvtap.c:81 page_owner free stack trace missing Memory state around the buggy address: ffff888056657300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888056657380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888056657400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888056657480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888056657500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1) 7: 00 00 00 a: 90 nop b: 90 nop c: 90 nop d: 90 nop e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 65 8b 05 b9 1d 0a 12 mov %gs:0x120a1db9(%rip),%eax # 0x120a1dda 21: 49 89 f8 mov %rdi,%r8 24: 49 89 f1 mov %rsi,%r9 27: 49 89 d2 mov %rdx,%r10 * 2a: 65 48 8b 3d 90 1d 0a mov %gs:0x120a1d90(%rip),%rdi # 0x120a1dc2 <-- trapping instruction 31: 12 32: a9 00 01 ff 00 test $0xff0100,%eax 37: 74 1b je 0x54 39: f6 c4 01 test $0x1,%ah 3c: 74 07 je 0x45 3e: a9 .byte 0xa9