------------[ cut here ]------------
kernfs_put: syz5/memory.events: released with incorrect active_ref 0
WARNING: CPU: 1 PID: 3900 at fs/kernfs/dir.c:531 kernfs_put.part.0+0x433/0x540
Modules linked in:
CPU: 1 PID: 3900 Comm: kworker/1:3 Not tainted 5.19.0-rc4-next-20220630 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
------------[ cut here ]------------
Workqueue: events kernfs_notify_workfn
WARNING: CPU: 0 PID: 112 at fs/kernfs/dir.c:504 kernfs_get.part.0+0x69/0x80
Modules linked in:
CPU: 0 PID: 112 Comm: systemd-journal Not tainted 5.19.0-rc4-next-20220630 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
RIP: 0010:kernfs_put.part.0+0x433/0x540
RIP: 0010:kernfs_get.part.0+0x69/0x80
Code: 03 80 3c 18 00 0f 85 ea 00 00 00 4d 8b 7d 38 e8 73 0a a7 ff 48 8b 14 24 44 89 f1 4c 89 fe 48 c7 c7 20 58 72 84 e8 7e 40 6c 02 <0f> 0b e9 b9 fc ff ff 48 89 ef e8 fe bb d9 ff e9 c1 fd ff ff e8 f4
Code: 31 ff 89 ee e8 c8 0b a7 ff 85 ed 74 18 e8 ef 0e a7 ff be 04 00 00 00 48 89 df e8 c2 c3 d9 ff f0 ff 03 5b 5d c3 e8 d7 0e a7 ff <0f> 0b eb df 48 89 df e8 6b c0 d9 ff eb c6 66 0f 1f 84 00 00 00 00
RSP: 0018:ffff888044acfbd8 EFLAGS: 00010286
RSP: 0018:ffff88806ce09c80 EFLAGS: 00010046
RAX: 0000000000000000 RBX: ffff8880441cf2b8 RCX: 0000000000000100
RDX: ffff88800f960000 RSI: ffffffff819d50a9 RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
R13: 1ffffffff0a01e40 R14: ffff8880441cf2b8 R15: ffff8880444f0490
FS: 00007fc588f82900(0000) GS:ffff88806ce00000(0000) knlGS:0000000000000000
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
RDX: ffff888010ce1ac0 RSI: ffffffff812b68e8 RDI: ffffed1008959f6d
CR2: 00007fc5883a1730 CR3: 000000000e3da000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
RBP: ffff8880441cf2f0 R08: 0000000000000005 R09: 0000000000000000
Call Trace:
R10: 0000000080000000 R11: 0000000000000001 R12: ffff8880441cf2b8
kernfs_get+0x1b/0x30
kernfs_notify+0x180/0x350
R13: ffff88800ddddae0 R14: 0000000000000000 R15: ffff888043efbc08
cgroup_file_notify+0xf5/0x1a0
FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
call_timer_fn+0x17d/0x5f0
CR2: 0000001b2be20000 CR3: 0000000041d92000 CR4: 0000000000350ee0
Call Trace:
kernfs_put+0x42/0x50
kernfs_notify_workfn+0x417/0x560
__run_timers.part.0+0x65e/0xa50
process_one_work+0xa17/0x1690
run_timer_softirq+0xae/0x1a0
__do_softirq+0x270/0x8c7
__irq_exit_rcu+0x113/0x170
worker_thread+0x637/0x1250
irq_exit_rcu+0x5/0x20
sysvec_apic_timer_interrupt+0x8e/0xc0
asm_sysvec_apic_timer_interrupt+0x1b/0x20
RIP: 0010:set_root+0x395/0x560
Code: 41 b8 01 00 00 00 b9 02 00 00 00 31 d2 31 f6 4c 89 ff e8 ee 9a a9 ff 48 8b 75 08 4c 89 ff e8 92 93 a9 ff e8 dd a9 cb ff fb 5a cb fd ff ff e8 61 ee c4 ff 4d 8d 6e 08 4c 89 ef e8 b5 85 9b 02
kthread+0x2f2/0x3b0
RSP: 0018:ffff88801873f960 EFLAGS: 00000206
RAX: 00000000000743c3 RBX: ffff88801873fc40 RCX: 1ffffffff0b1cdd1
ret_from_fork+0x22/0x30
RDX: ffffffff817f76a8 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff88801873f9d8 R08: 0000000000000001 R09: 0000000000000001
irq event stamp: 174995
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000200
hardirqs last enabled at (175003): [] console_emit_next_record.constprop.0+0x648/0x800
R13: 0000000000000000 R14: ffff88800955a100 R15: ffff88800955a150
hardirqs last disabled at (175012): [] console_emit_next_record.constprop.0+0x667/0x800
nd_jump_root+0x3c8/0x570
softirqs last enabled at (173302): [] process_one_work+0xa17/0x1690
path_init+0xefc/0x17b0
softirqs last disabled at (173298): [] neigh_periodic_work+0x62/0x9f0
---[ end trace 0000000000000000 ]---
path_openat+0x17d/0x2890
do_filp_open+0x1aa/0x400
do_sys_openat2+0x16d/0x4c0
__x64_sys_openat+0x13f/0x1f0
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7fc58983bc64
Code: 84 00 00 00 00 00 44 89 54 24 0c e8 36 61 f9 ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 34 44 89 c7 89 44 24 0c e8 68 61 f9 ff 8b 44
RSP: 002b:00007fff038cd830 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 000055a41ea58d60 RCX: 00007fc58983bc64
RDX: 0000000000080802 RSI: 000055a41ea612e0 RDI: 00000000ffffff9c
RBP: 000055a41ea612e0 R08: 0000000000000000 R09: ffffffffffffff01
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000080802
R13: 00000000fffffffa R14: 000055a41ea5f2b0 R15: 0000000000000002
irq event stamp: 476105
hardirqs last enabled at (476104): [] _raw_spin_unlock_irq+0x1f/0x40
hardirqs last disabled at (476105): [] _raw_spin_lock_irqsave+0x4e/0x50
softirqs last enabled at (475362): [] __mark_inode_dirty+0xba5/0xf00
softirqs last disabled at (476101): [] __irq_exit_rcu+0x113/0x170
---[ end trace 0000000000000000 ]---
==================================================================
BUG: KASAN: use-after-free in kernfs_get.part.0+0x5e/0x80
Write of size 4 at addr ffff8880441cf2b8 by task systemd-journal/112
CPU: 0 PID: 112 Comm: systemd-journal Tainted: G W 5.19.0-rc4-next-20220630 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
Call Trace:
dump_stack_lvl+0x8b/0xb3
print_report.cold+0x5e/0x5e1
kasan_report+0xbe/0x1c0
kasan_check_range+0x35/0x1b0
kernfs_get.part.0+0x5e/0x80
kernfs_get+0x1b/0x30
kernfs_notify+0x180/0x350
netlink: 2552 bytes leftover after parsing attributes in process `syz-executor.2'.
cgroup_file_notify+0xf5/0x1a0
call_timer_fn+0x17d/0x5f0
__run_timers.part.0+0x65e/0xa50
run_timer_softirq+0xae/0x1a0
__do_softirq+0x270/0x8c7
__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:set_root+0x395/0x560
Code: 41 b8 01 00 00 00 b9 02 00 00 00 31 d2 31 f6 4c 89 ff e8 ee 9a a9 ff 48 8b 75 08 4c 89 ff e8 92 93 a9 ff e8 dd a9 cb ff fb 5a cb fd ff ff e8 61 ee c4 ff 4d 8d 6e 08 4c 89 ef e8 b5 85 9b 02
RSP: 0018:ffff88801873f960 EFLAGS: 00000206
RAX: 00000000000743c3 RBX: ffff88801873fc40 RCX: 1ffffffff0b1cdd1
RDX: ffffffff817f76a8 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff88801873f9d8 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000200
R13: 0000000000000000 R14: ffff88800955a100 R15: ffff88800955a150
nd_jump_root+0x3c8/0x570
path_init+0xefc/0x17b0
path_openat+0x17d/0x2890
do_filp_open+0x1aa/0x400
do_sys_openat2+0x16d/0x4c0
__x64_sys_openat+0x13f/0x1f0
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7fc58983bc64
Code: 84 00 00 00 00 00 44 89 54 24 0c e8 36 61 f9 ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 34 44 89 c7 89 44 24 0c e8 68 61 f9 ff 8b 44
RSP: 002b:00007fff038cd830 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 000055a41ea58d60 RCX: 00007fc58983bc64
RDX: 0000000000080802 RSI: 000055a41ea612e0 RDI: 00000000ffffff9c
RBP: 000055a41ea612e0 R08: 0000000000000000 R09: ffffffffffffff01
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000080802
R13: 00000000fffffffa R14: 000055a41ea5f2b0 R15: 0000000000000002
Allocated by task 294:
kasan_save_stack+0x1e/0x40
__kasan_slab_alloc+0x66/0x80
kmem_cache_alloc+0x1b1/0x490
__kernfs_new_node+0xd4/0x8b0
kernfs_new_node+0x93/0x120
__kernfs_create_file+0x51/0x350
cgroup_addrm_files+0x3e2/0x9d0
css_populate_dir+0x19b/0x450
cgroup_apply_control_enable+0x3ae/0xa40
cgroup_mkdir+0x824/0x11f0
kernfs_iop_mkdir+0x149/0x1d0
vfs_mkdir+0x417/0x6a0
do_mkdirat+0x17b/0x2e0
__x64_sys_mkdir+0xf2/0x140
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Freed by task 3900:
kasan_save_stack+0x1e/0x40
kasan_set_track+0x21/0x30
kasan_set_free_info+0x20/0x30
____kasan_slab_free+0x14b/0x1a0
kmem_cache_free+0xfb/0x600
kernfs_put.part.0+0x2c7/0x540
kernfs_put+0x42/0x50
kernfs_notify_workfn+0x417/0x560
process_one_work+0xa17/0x1690
worker_thread+0x637/0x1250
kthread+0x2f2/0x3b0
ret_from_fork+0x22/0x30
The buggy address belongs to the object at ffff8880441cf2b8
which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 0 bytes inside of
168-byte region [ffff8880441cf2b8, ffff8880441cf360)
The buggy address belongs to the physical page:
page:00000000fb859800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x441cf
flags: 0x100000000000200(slab|node=0|zone=1)
raw: 0100000000000200 ffffea0000604100 dead000000000005 ffff8880080718c0
raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880441cf180: 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 00 00
ffff8880441cf200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
>ffff8880441cf280: fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb
^
ffff8880441cf300: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff8880441cf380: fc fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
loop3: detected capacity change from 0 to 2304
netlink: 2552 bytes leftover after parsing attributes in process `syz-executor.5'.
----------------
Code disassembly (best guess):
0: 41 b8 01 00 00 00 mov $0x1,%r8d
6: b9 02 00 00 00 mov $0x2,%ecx
b: 31 d2 xor %edx,%edx
d: 31 f6 xor %esi,%esi
f: 4c 89 ff mov %r15,%rdi
12: e8 ee 9a a9 ff callq 0xffa99b05
17: 48 8b 75 08 mov 0x8(%rbp),%rsi
1b: 4c 89 ff mov %r15,%rdi
1e: e8 92 93 a9 ff callq 0xffa993b5
23: e8 dd a9 cb ff callq 0xffcbaa05
28: fb sti
29: 5a pop %rdx
* 2a: e9 cb fd ff ff jmpq 0xfffffdfa <-- trapping instruction
2f: e8 61 ee c4 ff callq 0xffc4ee95
34: 4d 8d 6e 08 lea 0x8(%r14),%r13
38: 4c 89 ef mov %r13,%rdi
3b: e8 b5 85 9b 02 callq 0x29b85f5