------------[ cut here ]------------ kernfs_put: syz4/pids.events: released with incorrect active_ref 0 WARNING: CPU: 1 PID: 20 at fs/kernfs/dir.c:531 kernfs_put.part.0+0x433/0x540 Modules linked in: CPU: 1 PID: 20 Comm: kworker/1:0 Not tainted 5.19.0-rc4-next-20220701 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Workqueue: events kernfs_notify_workfn RIP: 0010:kernfs_put.part.0+0x433/0x540 Code: 03 80 3c 18 00 0f 85 ea 00 00 00 4d 8b 7d 38 e8 53 42 a7 ff 48 8b 14 24 44 89 f1 4c 89 fe 48 c7 c7 a0 58 72 84 e8 97 1c 6c 02 <0f> 0b e9 b9 fc ff ff 48 89 ef e8 8e b6 d9 ff e9 c1 fd ff ff e8 84 RSP: 0018:ffff8880082c7bd8 EFLAGS: 00010286 RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: ffff8880082b8000 RSI: ffffffff812b6848 RDI: ffffed1001058f6d RBP: ffff888036a1a778 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff888036a1a740 R13: ffff888037342828 R14: 0000000000000000 R15: ffff888008d4d4d8 FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f5ace4a97e0 CR3: 000000000d79e000 CR4: 0000000000350ee0 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 20 at fs/kernfs/dir.c:504 kernfs_get.part.0+0x69/0x80 Modules linked in: CPU: 1 PID: 20 Comm: kworker/1:0 Not tainted 5.19.0-rc4-next-20220701 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Workqueue: events kernfs_notify_workfn RIP: 0010:kernfs_get.part.0+0x69/0x80 Code: 31 ff 89 ee e8 a8 43 a7 ff 85 ed 74 18 e8 cf 46 a7 ff be 04 00 00 00 48 89 df e8 52 be d9 ff f0 ff 03 5b 5d c3 e8 b7 46 a7 ff <0f> 0b eb df 48 89 df e8 fb ba d9 ff eb c6 66 0f 1f 84 00 00 00 00 RSP: 0018:ffff88806cf09c80 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffff888036a1a740 RCX: 0000000000000100 RDX: ffff8880082b8000 RSI: ffffffff819d2579 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: 1ffffffff0a01e40 R14: ffff888036a1a740 R15: ffff88800de8e930 FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f5ace4a97e0 CR3: 000000000d79e000 CR4: 0000000000350ee0 Call Trace: kernfs_get+0x1b/0x30 kernfs_notify+0x180/0x350 cgroup_file_notify+0xf5/0x1a0 call_timer_fn+0x17d/0x5f0 __run_timers.part.0+0x65e/0xa50 run_timer_softirq+0xae/0x1a0 __do_softirq+0x1c8/0x8cc __irq_exit_rcu+0x113/0x170 irq_exit_rcu+0x5/0x20 sysvec_apic_timer_interrupt+0x8e/0xc0 asm_sysvec_apic_timer_interrupt+0x1b/0x20 RIP: 0010:desc_read+0x306/0x370 Code: 4c 89 e7 e8 dc 6d 4b 00 e9 87 fd ff ff 48 89 cf e8 3f 6e 4b 00 e9 29 ff ff ff e8 c5 6d 4b 00 e9 ed fe ff ff 41 be ff ff ff ff 7c ff ff ff e8 c0 6d 4b 00 e9 30 fd ff ff 4c 89 e7 e8 b3 6d 4b RSP: 0018:ffff8880082c73d0 EFLAGS: 00000287 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff812b70b2 RDX: ffff8880082b8000 RSI: 0000000000000000 RDI: 0000000000000006 RBP: ffff8880082c7598 R08: 0000000000000006 R09: 0000000000000000 R10: 00000000ffffe000 R11: 0000000000000001 R12: ffffffff851c7f60 R13: 00000000ffffe000 R14: 00000000ffffffff R15: 80000000ffffe000 desc_read_finalized_seq+0x81/0x1c0 _prb_read_valid+0x1aa/0x6f0 prb_read_valid+0x75/0xa0 console_emit_next_record.constprop.0+0x10a/0x800 console_unlock+0x36c/0x590 vprintk_emit+0x1b9/0x550 vprintk+0x80/0x90 _printk+0xba/0xed __show_regs.cold+0x3f4/0x481 show_regs+0x2f/0x40 __warn+0xe2/0x190 report_bug+0x1bc/0x210 handle_bug+0x3c/0x60 exc_invalid_op+0x14/0x40 asm_exc_invalid_op+0x1b/0x20 RIP: 0010:kernfs_put.part.0+0x433/0x540 Code: 03 80 3c 18 00 0f 85 ea 00 00 00 4d 8b 7d 38 e8 53 42 a7 ff 48 8b 14 24 44 89 f1 4c 89 fe 48 c7 c7 a0 58 72 84 e8 97 1c 6c 02 <0f> 0b e9 b9 fc ff ff 48 89 ef e8 8e b6 d9 ff e9 c1 fd ff ff e8 84 RSP: 0018:ffff8880082c7bd8 EFLAGS: 00010286 RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: ffff8880082b8000 RSI: ffffffff812b6848 RDI: ffffed1001058f6d RBP: ffff888036a1a778 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff888036a1a740 R13: ffff888037342828 R14: 0000000000000000 R15: ffff888008d4d4d8 kernfs_put+0x42/0x50 kernfs_notify_workfn+0x417/0x560 process_one_work+0xa0f/0x1690 worker_thread+0x637/0x1250 kthread+0x2ed/0x3a0 ret_from_fork+0x22/0x30 irq event stamp: 904085 hardirqs last enabled at (904084): [] _raw_spin_unlock_irq+0x1f/0x40 hardirqs last disabled at (904085): [] _raw_spin_lock_irqsave+0x4e/0x50 softirqs last enabled at (903892): [] __irq_exit_rcu+0x113/0x170 softirqs last disabled at (904081): [] __irq_exit_rcu+0x113/0x170 ---[ end trace 0000000000000000 ]--- Call Trace: kernfs_put+0x42/0x50 kernfs_notify_workfn+0x417/0x560 process_one_work+0xa0f/0x1690 worker_thread+0x637/0x1250 kthread+0x2ed/0x3a0 ret_from_fork+0x22/0x30 irq event stamp: 904857 hardirqs last enabled at (904867): [] __up_console_sem+0x78/0x80 hardirqs last disabled at (904878): [] __up_console_sem+0x5d/0x80 softirqs last enabled at (904616): [] __irq_exit_rcu+0x113/0x170 softirqs last disabled at (904611): [] __irq_exit_rcu+0x113/0x170 ---[ end trace 0000000000000000 ]--- ================================================================== BUG: KASAN: use-after-free in llist_del_first+0x89/0xa0 Read of size 8 at addr ffff888036a1a7c0 by task kworker/1:0/20 CPU: 1 PID: 20 Comm: kworker/1:0 Tainted: G W 5.19.0-rc4-next-20220701 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Workqueue: events kernfs_notify_workfn Call Trace: dump_stack_lvl+0x8b/0xb3 print_report.cold+0x5e/0x5e1 kasan_report+0xb1/0x1b0 ------------[ cut here ]------------ llist_del_first+0x89/0xa0 kernfs_notify_workfn+0x78/0x560 process_one_work+0xa0f/0x1690 worker_thread+0x637/0x1250 WARNING: CPU: 0 PID: 294 at fs/kernfs/dir.c:504 kernfs_get.part.0+0x69/0x80 Modules linked in: kthread+0x2ed/0x3a0 CPU: 0 PID: 294 Comm: syz-executor.1 Tainted: G W 5.19.0-rc4-next-20220701 #1 ret_from_fork+0x22/0x30 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:kernfs_get.part.0+0x69/0x80 Allocated by task 298: Code: 31 ff 89 ee e8 a8 43 a7 ff 85 ed 74 18 e8 cf 46 a7 ff be 04 00 00 00 48 89 df e8 52 be d9 ff f0 ff 03 5b 5d c3 e8 b7 46 a7 ff <0f> 0b eb df 48 89 df e8 fb ba d9 ff eb c6 66 0f 1f 84 00 00 00 00 kasan_save_stack+0x1e/0x40 RSP: 0018:ffff88806ce09c80 EFLAGS: 00010046 __kasan_slab_alloc+0x66/0x80 kmem_cache_alloc+0x1b1/0x490 RAX: 0000000000000000 RBX: ffff888036a1a740 RCX: 0000000000000100 __kernfs_new_node+0xd4/0x8b0 RDX: ffff888028849ac0 RSI: ffffffff819d2579 RDI: 0000000000000005 kernfs_new_node+0x93/0x120 RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000 __kernfs_create_file+0x51/0x350 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 cgroup_addrm_files+0x3e2/0x9d0 R13: 1ffffffff0a01e40 R14: ffff888036a1a740 R15: ffff88800de8e930 css_populate_dir+0x19b/0x450 FS: 00005555566e9400(0000) GS:ffff88806ce00000(0000) knlGS:0000000000000000 cgroup_apply_control_enable+0x3ae/0xa40 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 cgroup_mkdir+0x824/0x11f0 CR2: 00007f986d178c18 CR3: 000000001d8e6000 CR4: 0000000000350ef0 kernfs_iop_mkdir+0x149/0x1d0 Call Trace: vfs_mkdir+0x417/0x6a0 do_mkdirat+0x17b/0x2e0 kernfs_get+0x1b/0x30 __x64_sys_mkdir+0xf2/0x140 kernfs_notify+0x180/0x350 do_syscall_64+0x3b/0x90 cgroup_file_notify+0xf5/0x1a0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 20: call_timer_fn+0x17d/0x5f0 kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x30 kasan_set_free_info+0x20/0x30 __kasan_slab_free+0x108/0x190 kmem_cache_free+0xfb/0x600 kernfs_put.part.0+0x2c7/0x540 __run_timers.part.0+0x65e/0xa50 kernfs_put+0x42/0x50 kernfs_notify_workfn+0x417/0x560 process_one_work+0xa0f/0x1690 worker_thread+0x637/0x1250 run_timer_softirq+0xae/0x1a0 kthread+0x2ed/0x3a0 __do_softirq+0x1c8/0x8cc ret_from_fork+0x22/0x30 __irq_exit_rcu+0x113/0x170 The buggy address belongs to the object at ffff888036a1a740 which belongs to the cache kernfs_node_cache of size 168 irq_exit_rcu+0x5/0x20 The buggy address is located 128 bytes inside of 168-byte region [ffff888036a1a740, ffff888036a1a7e8) sysvec_apic_timer_interrupt+0x8e/0xc0 The buggy address belongs to the physical page: page:00000000c6e09979 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36a1a flags: 0x100000000000200(slab|node=0|zone=1) asm_sysvec_apic_timer_interrupt+0x1b/0x20 raw: 0100000000000200 0000000000000000 dead000000000122 ffff8880080718c0 RIP: 0010:lock_acquire+0x1db/0x530 raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000 Code: 02 b8 ff ff ff ff 65 0f c1 05 f9 6a d9 7e 83 f8 01 0f 85 c4 02 00 00 48 83 7c 24 08 00 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 48 8b 84 24 page dumped because: kasan: bad access detected RSP: 0018:ffff88802886f2d8 EFLAGS: 00000206 Memory state around the buggy address: ffff888036a1a680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888036a1a700: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb RAX: dffffc0000000000 RBX: 1ffff1100510de5d RCX: 00000000858c0e1b >ffff888036a1a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc RDX: 1ffff11005109486 RSI: 0000000000000000 RDI: 0000000000000000 ^ ffff888036a1a800: fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00 RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff86a5c7c7 ffff888036a1a880: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc R10: fffffbfff0d4b8f8 R11: 0000000000000001 R12: 0000000000000002 ================================================================== R13: 0000000000000000 R14: ffffffff852049a0 R15: 0000000000000000 __is_insn_slot_addr+0x3d/0x250 kernel_text_address+0x40/0xb0 __kernel_text_address+0x9/0x30 unwind_get_return_address+0x51/0x90 arch_stack_walk+0x99/0xf0 stack_trace_save+0x8c/0xc0 kasan_save_stack+0x1e/0x40 __kasan_slab_alloc+0x66/0x80 kmem_cache_alloc+0x1b1/0x490 __create_object.isra.0+0x3d/0xc10 __kmalloc_node+0x278/0x480 kvmalloc_node+0x41/0x1e0 xt_replace_table+0x1d0/0x810 __do_replace+0x1d7/0x860 do_ip6t_set_ctl+0x88c/0xaf0 nf_setsockopt+0x8b/0xf0 ipv6_setsockopt+0x122/0x190 tcp_setsockopt+0x139/0x26d0 __sys_setsockopt+0x180/0x2a0 __x64_sys_setsockopt+0xba/0x150 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7f986d09916a Code: 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 36 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe9ce2a3e8 EFLAGS: 00000202 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000029 RCX: 00007f986d09916a RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003 RBP: 00007ffe9ce2a410 R08: 00000000000003b8 R09: ffffffffffff0000 R10: 00007f986d178bc0 R11: 0000000000000202 R12: 00007ffe9ce2a470 R13: 0000000000000003 R14: 00007ffe9ce2a40c R15: 00007f986d178b60 irq event stamp: 407819 hardirqs last enabled at (407818): [] _raw_spin_unlock_irq+0x1f/0x40 hardirqs last disabled at (407819): [] _raw_spin_lock_irqsave+0x4e/0x50 softirqs last enabled at (407740): [] do_ipv6_setsockopt.constprop.0+0x10da/0x4570 softirqs last disabled at (407815): [] __irq_exit_rcu+0x113/0x170 ---[ end trace 0000000000000000 ]--- kmemleak: 5 new suspected memory leaks (see /sys/kernel/debug/kmemleak) ---------------- Code disassembly (best guess): 0: 4c 89 e7 mov %r12,%rdi 3: e8 dc 6d 4b 00 callq 0x4b6de4 8: e9 87 fd ff ff jmpq 0xfffffd94 d: 48 89 cf mov %rcx,%rdi 10: e8 3f 6e 4b 00 callq 0x4b6e54 15: e9 29 ff ff ff jmpq 0xffffff43 1a: e8 c5 6d 4b 00 callq 0x4b6de4 1f: e9 ed fe ff ff jmpq 0xffffff11 24: 41 be ff ff ff ff mov $0xffffffff,%r14d * 2a: e9 7c ff ff ff jmpq 0xffffffab <-- trapping instruction 2f: e8 c0 6d 4b 00 callq 0x4b6df4 34: e9 30 fd ff ff jmpq 0xfffffd69 39: 4c 89 e7 mov %r12,%rdi 3c: e8 .byte 0xe8 3d: b3 6d mov $0x6d,%bl 3f: 4b rex.WXB