------------[ cut here ]------------ percpu ref (css_release) <= 0 (-3) after switching to atomic WARNING: lib/percpu-refcount.c:197 at percpu_ref_switch_to_atomic_rcu+0x3cc/0x480, CPU#0: systemd/1 Modules linked in: CPU: 0 UID: 0 PID: 1 Comm: systemd Tainted: G W 6.17.0-rc4-next-20250901 #1 PREEMPT(voluntary) Tainted: [W]=WARN Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:percpu_ref_switch_to_atomic_rcu+0x3cc/0x480 Code: 00 00 00 00 00 fc ff df 48 89 f9 48 c1 e9 03 80 3c 01 00 0f 85 9e 00 00 00 49 8b 75 e8 48 c7 c7 c0 99 e2 84 e8 25 ac e9 fe 90 <0f> 0b 90 90 e9 2b ff ff ff e8 56 de 5f ff e9 9e fe ff ff e8 dc de RSP: 0018:ffff88806ce08e20 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff8139de70 RDX: ffff8880094f8000 RSI: ffffffff8139de7e RDI: 0000000000000001 RBP: 7ffffffffffffffc R08: 0000000000000001 R09: ffffed100d9c4801 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88800a19d180 R13: ffff88800a19d1a0 R14: 0000000000000002 R15: 0000000000000003 FS: 00007f139c023900(0000) GS:ffff8880e55d8000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055e3b792fb00 CR3: 000000000ce03000 CR4: 0000000000350ef0 Call Trace: rcu_core+0x7c8/0x1800 handle_softirqs+0x1b1/0x770 __irq_exit_rcu+0xc4/0x100 irq_exit_rcu+0x9/0x20 sysvec_apic_timer_interrupt+0x70/0x80 asm_sysvec_apic_timer_interrupt+0x1a/0x20 RIP: 0010:lock_acquire+0x5b/0x2f0 Code: 30 31 c0 66 90 65 8b 05 e7 a3 32 06 89 c0 48 0f a3 05 f9 d7 f1 04 0f 82 3a 01 00 00 8b 35 d1 e3 f1 04 85 f6 0f 85 84 00 00 00 <48> 8b 44 24 30 65 48 2b 05 90 a3 32 06 0f 85 6e 02 00 00 48 83 c4 RSP: 0018:ffff888009547610 EFLAGS: 00000206 RAX: 0000000000000001 RBX: 0000000000000000 RCX: 2b96e82a1fd671b7 RDX: 00000000c3e86e4b RSI: 0000000015100c96 RDI: 000000000f0d462e RBP: ffffffff85c1c760 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000002 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000200 unwind_next_frame+0xcd/0x2540 arch_stack_walk+0x86/0xf0 stack_trace_save+0x8e/0xc0 kasan_save_stack+0x24/0x50 kasan_record_aux_stack+0x89/0xa0 __call_rcu_common.constprop.0+0x70/0x960 kernfs_put.part.0+0x160/0x610 kernfs_put+0x4d/0x60 evict+0x368/0x860 iput.part.0+0x541/0x770 iput+0x62/0x80 dentry_unlink_inode+0x2bb/0x4a0 __dentry_kill+0x1d2/0x5f0 shrink_dentry_list+0x13d/0x650 shrink_dcache_parent+0x1c4/0x590 vfs_rmdir.part.0+0x27c/0x5e0 do_rmdir+0x325/0x420 __x64_sys_rmdir+0xc7/0x110 do_syscall_64+0xbf/0x360 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f139c7f2bb7 Code: 73 01 c3 48 8b 0d d9 d2 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 54 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a9 d2 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007fff38162ba8 EFLAGS: 00000202 ORIG_RAX: 0000000000000054 RAX: ffffffffffffffda RBX: 000055e3b79f2820 RCX: 00007f139c7f2bb7 RDX: 00007f139c8c0be0 RSI: 0000000000000000 RDI: 000055e3b7a0bde0 RBP: 00007f139cbe1351 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000100 R11: 0000000000000202 R12: 0000000000000000 R13: 00007f139c0236c8 R14: 0000000000000001 R15: 0000000000000001 irq event stamp: 6585898 hardirqs last enabled at (6585908): [] __up_console_sem+0x78/0x80 hardirqs last disabled at (6585917): [] __up_console_sem+0x5d/0x80 softirqs last enabled at (6584614): [] handle_softirqs+0x50c/0x770 softirqs last disabled at (6584755): [] __irq_exit_rcu+0xc4/0x100 ---[ end trace 0000000000000000 ]--- percpu_ref_switch_to_atomic_rcu: percpu_ref_switch_to_atomic_rcu(): percpu_ref underflow slab kmalloc-64 start ffff88800a19d180 pointer offset 0 size 64 ================================================================== BUG: KASAN: slab-use-after-free in put_css_set_locked+0xbbb/0xd80 Read of size 4 at addr ffff88801f64e04c by task ksoftirqd/0/14 CPU: 0 UID: 0 PID: 14 Comm: ksoftirqd/0 Tainted: G W 6.17.0-rc4-next-20250901 #1 PREEMPT(voluntary) Tainted: [W]=WARN Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0xca/0x120 print_report+0xcb/0x610 kasan_report+0xca/0x100 put_css_set_locked+0xbbb/0xd80 cgroup_free+0x87/0x1d0 __put_task_struct+0x10f/0x510 rcu_core+0x7c8/0x1800 handle_softirqs+0x1b1/0x770 run_ksoftirqd+0x2e/0x60 smpboot_thread_fn+0x41d/0x9d0 kthread+0x3c8/0x740 ret_from_fork+0x34b/0x430 ret_from_fork_asm+0x1a/0x30 Allocated by task 1: kasan_save_stack+0x24/0x50 kasan_save_track+0x14/0x30 __kasan_kmalloc+0x7f/0x90 perf_cgroup_css_alloc+0x44/0xf0 cgroup_apply_control_enable+0x446/0x9f0 cgroup_mkdir+0x86e/0x1110 kernfs_iop_mkdir+0x111/0x190 vfs_mkdir+0x59a/0x8d0 do_mkdirat+0x19f/0x3d0 __x64_sys_mkdir+0xf3/0x140 do_syscall_64+0xbf/0x360 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 9: kasan_save_stack+0x24/0x50 kasan_save_track+0x14/0x30 __kasan_save_free_info+0x3a/0x60 __kasan_slab_free+0x3f/0x50 kfree+0x281/0x550 css_free_rwork_fn+0x125/0x1110 process_one_work+0x8e1/0x19c0 worker_thread+0x67e/0xe90 kthread+0x3c8/0x740 ret_from_fork+0x34b/0x430 ret_from_fork_asm+0x1a/0x30 Last potentially related work creation: kasan_save_stack+0x24/0x50 kasan_record_aux_stack+0x89/0xa0 __queue_work+0xa3b/0x1240 rcu_work_rcufn+0x5c/0x90 rcu_core+0x7c8/0x1800 handle_softirqs+0x1b1/0x770 __irq_exit_rcu+0xc4/0x100 irq_exit_rcu+0x9/0x20 sysvec_apic_timer_interrupt+0x70/0x80 asm_sysvec_apic_timer_interrupt+0x1a/0x20 Second to last potentially related work creation: kasan_save_stack+0x24/0x50 kasan_record_aux_stack+0x89/0xa0 __call_rcu_common.constprop.0+0x70/0x960 queue_rcu_work+0xa9/0xe0 process_one_work+0x8e1/0x19c0 worker_thread+0x67e/0xe90 kthread+0x3c8/0x740 ret_from_fork+0x34b/0x430 ret_from_fork_asm+0x1a/0x30 The buggy address belongs to the object at ffff88801f64e000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 76 bytes inside of freed 512-byte region [ffff88801f64e000, ffff88801f64e200) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f64c head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x100000000000040(head|node=0|zone=1) page_type: f5(slab) raw: 0100000000000040 ffff888008c41c80 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 0100000000000040 ffff888008c41c80 0000000000000000 dead000000000001 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 0100000000000002 ffffea00007d9301 00000000ffffffff 00000000ffffffff head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88801f64df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88801f64df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88801f64e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801f64e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801f64e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 0 P4D 0 Oops: Oops: 0002 [#1] SMP KASAN NOPTI CPU: 0 UID: 0 PID: 14 Comm: ksoftirqd/0 Tainted: G B W 6.17.0-rc4-next-20250901 #1 PREEMPT(voluntary) Tainted: [B]=BAD_PAGE, [W]=WARN Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:put_css_set_locked+0xa91/0xd80 Code: f8 48 c1 e8 03 80 3c 28 00 0f 85 34 02 00 00 49 8b 56 18 be 08 00 00 00 48 89 d7 48 89 54 24 08 e8 54 d5 44 00 48 8b 54 24 08 48 83 2a 01 0f 94 c0 31 ff 89 c6 88 44 24 08 e8 5a af 08 00 0f RSP: 0018:ffff888009617c08 EFLAGS: 00010002 RAX: 0000000000000001 RBX: ffff88803dd1b158 RCX: ffffffff816b420c RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000000 RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000001 R12: ffff88803dd1b040 R13: 0000000000000008 R14: ffff88801f64e000 R15: ffff88801f64e018 FS: 0000000000000000(0000) GS:ffff8880e55d8000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000041a1c000 CR4: 0000000000350ef0 Call Trace: cgroup_free+0x87/0x1d0 __put_task_struct+0x10f/0x510 rcu_core+0x7c8/0x1800 handle_softirqs+0x1b1/0x770 run_ksoftirqd+0x2e/0x60 smpboot_thread_fn+0x41d/0x9d0 kthread+0x3c8/0x740 ret_from_fork+0x34b/0x430 ret_from_fork_asm+0x1a/0x30 Modules linked in: CR2: 0000000000000000 ---[ end trace 0000000000000000 ]--- RIP: 0010:put_css_set_locked+0xa91/0xd80 Code: f8 48 c1 e8 03 80 3c 28 00 0f 85 34 02 00 00 49 8b 56 18 be 08 00 00 00 48 89 d7 48 89 54 24 08 e8 54 d5 44 00 48 8b 54 24 08 48 83 2a 01 0f 94 c0 31 ff 89 c6 88 44 24 08 e8 5a af 08 00 0f RSP: 0018:ffff888009617c08 EFLAGS: 00010002 RAX: 0000000000000001 RBX: ffff88803dd1b158 RCX: ffffffff816b420c RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000000 RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000001 R12: ffff88803dd1b040 R13: 0000000000000008 R14: ffff88801f64e000 R15: ffff88801f64e018 FS: 0000000000000000(0000) GS:ffff8880e55d8000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000041a1c000 CR4: 0000000000350ef0 ---------------- Code disassembly (best guess): 0: 30 31 xor %dh,(%rcx) 2: c0 66 90 65 shlb $0x65,-0x70(%rsi) 6: 8b 05 e7 a3 32 06 mov 0x632a3e7(%rip),%eax # 0x632a3f3 c: 89 c0 mov %eax,%eax e: 48 0f a3 05 f9 d7 f1 bt %rax,0x4f1d7f9(%rip) # 0x4f1d80f 15: 04 16: 0f 82 3a 01 00 00 jb 0x156 1c: 8b 35 d1 e3 f1 04 mov 0x4f1e3d1(%rip),%esi # 0x4f1e3f3 22: 85 f6 test %esi,%esi 24: 0f 85 84 00 00 00 jne 0xae * 2a: 48 8b 44 24 30 mov 0x30(%rsp),%rax <-- trapping instruction 2f: 65 48 2b 05 90 a3 32 sub %gs:0x632a390(%rip),%rax # 0x632a3c7 36: 06 37: 0f 85 6e 02 00 00 jne 0x2ab 3d: 48 rex.W 3e: 83 .byte 0x83 3f: c4 .byte 0xc4