================================================================== 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 ffff88804a752018 by task kworker/u33:7/293 CPU: 3 UID: 0 PID: 293 Comm: kworker/u33:7 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/0x1c0 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+0x132/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/0x660 drivers/virtio/virtio_ring.c:3297 __handle_irq_event_percpu+0x232/0x880 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+0x34c/0x950 kernel/irq/chip.c:859 generic_handle_irq_desc include/linux/irqdesc.h:188 [inline] handle_irq arch/x86/kernel/irq.c:209 [inline] call_irq_handler arch/x86/kernel/irq.c:265 [inline] __common_interrupt+0xd8/0x2f0 arch/x86/kernel/irq.c:280 common_interrupt+0xb9/0xe0 arch/x86/kernel/irq.c:273 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665 RIP: 0010:kvm_smp_send_call_func_ipi+0x16b/0x1b0 arch/x86/kernel/kvm.c:655 Code: 00 fc ff df 48 89 da 48 c1 ea 03 0f b6 14 02 48 89 d8 83 e0 07 83 c0 03 38 d0 7c 04 84 d2 75 1c 8b 1b b8 0b 00 00 00 0f 01 c1 5a ff ff ff 48 89 ef e8 c8 5f c3 00 e9 ce fe ff ff 48 89 df e8 RSP: 0018:ffffc90003327820 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81b7a1fd RDX: 0000000000000000 RSI: ffffffff81b7a207 RDI: ffffffff8e470928 RBP: ffff88806a73c890 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffffed100d4e7912 R13: ffffffffffffffff R14: 0000000000000001 R15: 0000000000000001 arch_send_call_function_ipi_mask arch/x86/include/asm/smp.h:100 [inline] send_call_function_ipi_mask kernel/smp.c:129 [inline] smp_call_function_many_cond+0xfc4/0x1870 kernel/smp.c:894 on_each_cpu_cond_mask+0x40/0x90 kernel/smp.c:1077 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+0x976/0xc60 arch/x86/kernel/alternative.c:3045 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_disable_cpuslocked+0x162/0x1c0 kernel/jump_label.c:240 static_key_disable+0x1a/0x20 kernel/jump_label.c:248 toggle_allocation_gate mm/kfence/core.c:918 [inline] toggle_allocation_gate+0x149/0x2d0 mm/kfence/core.c:903 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 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 6243: 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 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2e5/0x6c0 mm/slub.c:5489 _kmalloc_noprof include/linux/slab.h:988 [inline] p9_client_create+0xaf/0xd40 net/9p/client.c:864 v9fs_session_init+0x3c/0xdd0 fs/9p/v9fs.c:471 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1700 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3765 [inline] do_new_mount fs/namespace.c:3841 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4161 do_mount fs/namespace.c:4174 [inline] __do_sys_mount fs/namespace.c:4390 [inline] __se_sys_mount fs/namespace.c:4367 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4367 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6243: 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:2677 [inline] slab_free mm/slub.c:6377 [inline] kfree+0x22b/0x6c0 mm/slub.c:6692 p9_client_create+0x72d/0xd40 net/9p/client.c:943 v9fs_session_init+0x3c/0xdd0 fs/9p/v9fs.c:471 v9fs_get_tree+0xb8/0xb50 fs/9p/vfs_super.c:97 vfs_get_tree+0x92/0x320 fs/super.c:1700 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3765 [inline] do_new_mount fs/namespace.c:3841 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4161 do_mount fs/namespace.c:4174 [inline] __do_sys_mount fs/namespace.c:4390 [inline] __se_sys_mount fs/namespace.c:4367 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4367 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88804a752000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 24 bytes inside of freed 512-byte region [ffff88804a752000, ffff88804a752200) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88804a753000 pfn:0x4a750 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801bc42c80 ffffea0000903a10 ffffea00015bb910 raw: ffff88804a753000 000000080010000d 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801bc42c80 ffffea0000903a10 ffffea00015bb910 head: ffff88804a753000 000000080010000d 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 5787, tgid 5787 (kworker/u32:2), ts 128264660689, free_ts 127860300484 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3266 [inline] allocate_slab mm/slub.c:3380 [inline] new_slab+0xa2/0x640 mm/slub.c:3426 refill_objects+0xe3/0x410 mm/slub.c:7310 refill_sheaf mm/slub.c:2804 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675 alloc_from_pcs mm/slub.c:4773 [inline] slab_alloc_node mm/slub.c:4905 [inline] __kmalloc_cache_noprof+0x479/0x6c0 mm/slub.c:5485 _kmalloc_noprof include/linux/slab.h:988 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] mca_alloc net/ipv6/mcast.c:871 [inline] __ipv6_dev_mc_inc+0x2f1/0xbd0 net/ipv6/mcast.c:961 addrconf_join_solict net/ipv6/addrconf.c:2262 [inline] addrconf_dad_begin net/ipv6/addrconf.c:4134 [inline] addrconf_dad_work+0x276/0x1360 net/ipv6/addrconf.c:4262 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 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 page last free pid 5863 tgid 5863 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4584 [inline] slab_alloc_node mm/slub.c:4917 [inline] __kmalloc_cache_noprof+0x265/0x6c0 mm/slub.c:5485 _kmalloc_noprof include/linux/slab.h:988 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] tomoyo_find_next_domain+0xfd/0x2010 security/tomoyo/domain.c:711 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:102 [inline] tomoyo_bprm_check_security+0x12d/0x1d0 security/tomoyo/tomoyo.c:92 security_bprm_check+0x87/0x1e0 security/security.c:820 search_binary_handler fs/exec.c:1684 [inline] exec_binprm fs/exec.c:1726 [inline] bprm_execve fs/exec.c:1778 [inline] bprm_execve+0x84b/0x1730 fs/exec.c:1754 kernel_execve+0x31e/0x3a0 fs/exec.c:1922 call_usermodehelper_exec_async+0x239/0x4b0 kernel/umh.c:109 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff88804a751f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88804a751f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88804a752000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804a752080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804a752100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 4 bytes skipped: 0: 48 89 da mov %rbx,%rdx 3: 48 c1 ea 03 shr $0x3,%rdx 7: 0f b6 14 02 movzbl (%rdx,%rax,1),%edx b: 48 89 d8 mov %rbx,%rax e: 83 e0 07 and $0x7,%eax 11: 83 c0 03 add $0x3,%eax 14: 38 d0 cmp %dl,%al 16: 7c 04 jl 0x1c 18: 84 d2 test %dl,%dl 1a: 75 1c jne 0x38 1c: 8b 1b mov (%rbx),%ebx 1e: b8 0b 00 00 00 mov $0xb,%eax 23: 0f 01 c1 vmcall * 26: e9 5a ff ff ff jmp 0xffffff85 <-- trapping instruction 2b: 48 89 ef mov %rbp,%rdi 2e: e8 c8 5f c3 00 call 0xc35ffb 33: e9 ce fe ff ff jmp 0xffffff06 38: 48 89 df mov %rbx,%rdi 3b: e8 .byte 0xe8