================================================================== BUG: KASAN: slab-use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x271/0x2c0 kernel/locking/spinlock_debug.c:115 Read of size 4 at addr ffff888021945004 by task kworker/u32:1/12 CPU: 0 UID: 0 PID: 12 Comm: kworker/u32:1 Not tainted 6.13.0-syzkaller-02526-gc4b9570cfb63 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: events_unbound nsim_dev_trap_report_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] do_raw_spin_lock+0x271/0x2c0 kernel/locking/spinlock_debug.c:115 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/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:2715 [inline] vring_interrupt+0x31b/0x400 drivers/virtio/virtio_ring.c:2690 __handle_irq_event_percpu+0x229/0x7d0 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+0xba/0xe0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 f6 ce 53 f6 48 89 df e8 3e 4e 54 f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 15 2e 45 f6 65 8b 05 a6 55 e1 74 85 c0 74 16 5b RSP: 0000:ffffc900001e7928 EFLAGS: 00000246 RAX: 0000000000000002 RBX: ffffffff9a9e5fc8 RCX: 1ffffffff2dcc415 RDX: 0000000000000000 RSI: ffffffff8b6cd2e0 RDI: ffffffff8bd24960 RBP: 0000000000000282 R08: 0000000000000001 R09: fffffbfff2dbe3bb R10: ffffffff96df1ddf R11: 0000000000000004 R12: ffff88801ede8000 R13: 0000000000000001 R14: 0000000000000001 R15: ffff88801ede8000 __debug_check_no_obj_freed lib/debugobjects.c:1108 [inline] debug_check_no_obj_freed+0x327/0x600 lib/debugobjects.c:1129 slab_free_hook mm/slub.c:2284 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x2b3/0x4b0 mm/slub.c:4761 skb_kfree_head net/core/skbuff.c:1086 [inline] skb_free_head+0x108/0x1d0 net/core/skbuff.c:1098 skb_release_data+0x560/0x730 net/core/skbuff.c:1125 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb net/core/skbuff.c:1204 [inline] consume_skb net/core/skbuff.c:1436 [inline] consume_skb+0xbf/0x100 net/core/skbuff.c:1430 nsim_dev_trap_report drivers/net/netdevsim/dev.c:821 [inline] nsim_dev_trap_report_work+0x8e6/0xd20 drivers/net/netdevsim/dev.c:851 process_one_work+0x958/0x1b30 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3317 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3398 kthread+0x3af/0x750 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 6014: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:901 [inline] p9_client_create+0xc8/0x11a0 net/9p/client.c:985 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa30 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8b/0x340 fs/super.c:1814 do_new_mount fs/namespace.c:3560 [inline] path_mount+0x6e1/0x1f00 fs/namespace.c:3887 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount fs/namespace.c:4088 [inline] __ia32_sys_mount+0x28d/0x310 fs/namespace.c:4088 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 6014: 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:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x14f/0x4b0 mm/slub.c:4761 p9_client_create+0x97d/0x11a0 net/9p/client.c:1064 v9fs_session_init+0x1f8/0x1a80 fs/9p/v9fs.c:410 v9fs_mount+0xc6/0xa30 fs/9p/vfs_super.c:122 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8b/0x340 fs/super.c:1814 do_new_mount fs/namespace.c:3560 [inline] path_mount+0x6e1/0x1f00 fs/namespace.c:3887 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount fs/namespace.c:4088 [inline] __ia32_sys_mount+0x28d/0x310 fs/namespace.c:4088 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 ffff888021945000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 4 bytes inside of freed 512-byte region [ffff888021945000, ffff888021945200) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21944 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 ffff88801b042c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000 head: 00fff00000000002 ffffea0000865101 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 5953, tgid 5953 (syz-executor), ts 46868097608, free_ts 46338316609 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1558 prep_new_page mm/page_alloc.c:1566 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3476 __alloc_pages_slowpath mm/page_alloc.c:4288 [inline] __alloc_pages_noprof+0x6a6/0x2470 mm/page_alloc.c:4766 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_slab_page mm/slub.c:2425 [inline] allocate_slab mm/slub.c:2589 [inline] new_slab+0xca/0x410 mm/slub.c:2642 ___slab_alloc+0xbcd/0x1590 mm/slub.c:3830 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3920 __slab_alloc_node mm/slub.c:3995 [inline] slab_alloc_node mm/slub.c:4156 [inline] __kmalloc_cache_node_noprof+0xfb/0x3f0 mm/slub.c:4337 kmalloc_node_noprof include/linux/slab.h:924 [inline] alloc_fair_sched_group+0x212/0x4f0 kernel/sched/fair.c:13337 sched_create_group+0x2d/0x80 kernel/sched/core.c:8936 cpu_cgroup_css_alloc kernel/sched/core.c:9096 [inline] cpu_cgroup_css_alloc+0x15/0x30 kernel/sched/core.c:9086 css_create kernel/cgroup/cgroup.c:5631 [inline] cgroup_apply_control_enable+0x4b6/0xc80 kernel/cgroup/cgroup.c:3239 cgroup_mkdir+0x398/0x1150 kernel/cgroup/cgroup.c:5847 kernfs_iop_mkdir+0x14a/0x1d0 fs/kernfs/dir.c:1246 vfs_mkdir+0x57d/0x860 fs/namei.c:4311 do_mkdirat+0x301/0x3a0 fs/namei.c:4334 __do_sys_mkdirat fs/namei.c:4349 [inline] __se_sys_mkdirat fs/namei.c:4347 [inline] __ia32_sys_mkdirat+0x82/0xb0 fs/namei.c:4347 page last free pid 6002 tgid 6002 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x661/0x1080 mm/page_alloc.c:2659 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4119 [inline] slab_alloc_node mm/slub.c:4168 [inline] kmem_cache_alloc_noprof+0x1c8/0x3b0 mm/slub.c:4175 getname_flags.part.0+0x4c/0x550 fs/namei.c:139 getname_flags include/linux/audit.h:322 [inline] getname+0x8d/0xe0 fs/namei.c:223 getname_maybe_null include/linux/fs.h:2812 [inline] vfs_fstatat+0xdf/0xf0 fs/stat.c:361 __do_sys_newfstatat+0x98/0x120 fs/stat.c:530 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888021944f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888021944f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888021945000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888021945080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021945100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 f6 ce 53 f6 call 0xf653cf09 13: 48 89 df mov %rbx,%rdi 16: e8 3e 4e 54 f6 call 0xf6544e59 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 15 2e 45 f6 call 0xf6452e49 34: 65 8b 05 a6 55 e1 74 mov %gs:0x74e155a6(%rip),%eax # 0x74e155e1 3b: 85 c0 test %eax,%eax 3d: 74 16 je 0x55 3f: 5b pop %rbx