------------[ cut here ]------------
kernfs_put: syz3/memory.events.local: released with incorrect active_ref 0
WARNING: CPU: 1 PID: 84 at fs/kernfs/dir.c:531 kernfs_put.part.0+0x433/0x540
------------[ cut here ]------------
Modules linked in:
WARNING: CPU: 0 PID: 4323 at fs/kernfs/dir.c:504 kernfs_get.part.0+0x69/0x80
CPU: 1 PID: 84 Comm: kworker/1:3 Not tainted 5.19.0-rc4-next-20220701 #1
Modules linked in:
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
CPU: 0 PID: 4323 Comm: syz-executor.4 Not tainted 5.19.0-rc4-next-20220701 #1
Workqueue: events kernfs_notify_workfn
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
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:ffff88806ce09c80 EFLAGS: 00010046
RAX: 0000000000000000 RBX: ffff88801b62f828 RCX: 0000000000000100
RIP: 0010:kernfs_put.part.0+0x433/0x540
RDX: ffff8880451e1ac0 RSI: ffffffff819d2579 RDI: 0000000000000005
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
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
RSP: 0018:ffff88800fa4fbd8 EFLAGS: 00010286
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
R13: 1ffffffff0a01e40 R14: ffff88801b62f828 R15: ffff888045ea04f0
FS: 00007f82e5737700(0000) GS:ffff88806ce00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d735000 CR3: 0000000008610000 CR4: 0000000000350ef0
Call Trace:
kernfs_get+0x1b/0x30
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000
kernfs_notify+0x180/0x350
cgroup_file_notify+0xf5/0x1a0
RDX: ffff88800fb1b580 RSI: ffffffff812b6848 RDI: ffffed1001f49f6d
RBP: ffff88801b62f860 R08: 0000000000000005 R09: 0000000000000000
call_timer_fn+0x17d/0x5f0
R10: 0000000080000000 R11: 0000000000000001 R12: ffff88801b62f828
R13: ffff88800dc4de80 R14: 0000000000000000 R15: ffff88800ec125a0
FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2dd2b000 CR3: 0000000008610000 CR4: 0000000000350ee0
__run_timers.part.0+0x65e/0xa50
Call Trace:
run_timer_softirq+0xae/0x1a0
kernfs_put+0x42/0x50
__do_softirq+0x1c8/0x8cc
__irq_exit_rcu+0x113/0x170
kernfs_notify_workfn+0x417/0x560
irq_exit_rcu+0x5/0x20
sysvec_apic_timer_interrupt+0x8e/0xc0
asm_sysvec_apic_timer_interrupt+0x1b/0x20
RIP: 0010:kvm_flush_tlb_multi+0x2/0x310
process_one_work+0xa0f/0x1690
Code: a4 c6 7d 04 72 d8 5b 5d 41 5c 41 5d c3 48 c7 c7 40 94 8e 85 e8 cf 12 66 00 eb e3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 41 57 <41> 56 41 55 49 bd 00 00 00 00 00 fc ff df 41 54 55 48 c7 c5 c0 72
RSP: 0018:ffff888046c77870 EFLAGS: 00000297
RAX: 0000000000000003 RBX: ffff888016f1d400 RCX: 1ffffffff0b1d288
RDX: 0000000000000000 RSI: ffff88806ce37480 RDI: ffff888016f1da78
RBP: ffff88806ce37480 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000001
R13: ffff888016f1da78 R14: ffffffffffffffff R15: 0000000000000000
worker_thread+0x637/0x1250
flush_tlb_mm_range+0x297/0x3a0
tlb_finish_mmu+0x33c/0x7f0
kthread+0x2ed/0x3a0
unmap_region+0x261/0x2f0
do_mas_align_munmap.constprop.0+0x924/0xff0
ret_from_fork+0x22/0x30
irq event stamp: 389937
hardirqs last enabled at (389945): [] console_emit_next_record.constprop.0+0x648/0x800
do_mas_munmap+0x1e8/0x2b0
mmap_region+0x21c/0x19f0
hardirqs last disabled at (389954): [] console_emit_next_record.constprop.0+0x667/0x800
softirqs last enabled at (389488): [] __irq_exit_rcu+0x113/0x170
softirqs last disabled at (389467): [] __irq_exit_rcu+0x113/0x170
do_mmap+0x824/0xf40
vm_mmap_pgoff+0x1ab/0x270
---[ end trace 0000000000000000 ]---
ksys_mmap_pgoff+0x3cc/0x4f0
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f82e81c1b62
Code: 00 00 00 00 00 0f 1f 00 41 f7 c1 ff 0f 00 00 75 27 55 48 89 fd 53 89 cb 48 85 ff 74 3b 41 89 da 48 89 ef b8 09 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 5b 5d c3 0f 1f 00 48 c7 c0 bc ff ff ff 64
RSP: 002b:00007f82e57370f8 EFLAGS: 00000206 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 0000000000008011 RCX: 00007f82e81c1b62
RDX: 0000000000000003 RSI: 0000000000200000 RDI: 0000000020ffc000
RBP: 0000000020ffc000 R08: 0000000000000008 R09: 0000000010000000
R10: 0000000000008011 R11: 0000000000000206 R12: 0000000020000300
R13: 0000000020ffc000 R14: 0000000020000200 R15: 0000000020ffe000
irq event stamp: 8099
hardirqs last enabled at (8098): [] _raw_spin_unlock_irq+0x1f/0x40
hardirqs last disabled at (8099): [] _raw_spin_lock_irqsave+0x4e/0x50
softirqs last enabled at (7884): [] __irq_exit_rcu+0x113/0x170
softirqs last disabled at (8073): [] __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 ffff88801b62f828 by task syz-executor.4/4323
CPU: 0 PID: 4323 Comm: syz-executor.4 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
Call Trace:
dump_stack_lvl+0x8b/0xb3
print_report.cold+0x5e/0x5e1
kasan_report+0xb1/0x1b0
kasan_check_range+0x35/0x1b0
kernfs_get.part.0+0x5e/0x80
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:kvm_flush_tlb_multi+0x2/0x310
Code: a4 c6 7d 04 72 d8 5b 5d 41 5c 41 5d c3 48 c7 c7 40 94 8e 85 e8 cf 12 66 00 eb e3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 41 57 <41> 56 41 55 49 bd 00 00 00 00 00 fc ff df 41 54 55 48 c7 c5 c0 72
RSP: 0018:ffff888046c77870 EFLAGS: 00000297
RAX: 0000000000000003 RBX: ffff888016f1d400 RCX: 1ffffffff0b1d288
RDX: 0000000000000000 RSI: ffff88806ce37480 RDI: ffff888016f1da78
RBP: ffff88806ce37480 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000001
R13: ffff888016f1da78 R14: ffffffffffffffff R15: 0000000000000000
flush_tlb_mm_range+0x297/0x3a0
tlb_finish_mmu+0x33c/0x7f0
unmap_region+0x261/0x2f0
do_mas_align_munmap.constprop.0+0x924/0xff0
do_mas_munmap+0x1e8/0x2b0
mmap_region+0x21c/0x19f0
do_mmap+0x824/0xf40
vm_mmap_pgoff+0x1ab/0x270
ksys_mmap_pgoff+0x3cc/0x4f0
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f82e81c1b62
Code: 00 00 00 00 00 0f 1f 00 41 f7 c1 ff 0f 00 00 75 27 55 48 89 fd 53 89 cb 48 85 ff 74 3b 41 89 da 48 89 ef b8 09 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 5b 5d c3 0f 1f 00 48 c7 c0 bc ff ff ff 64
RSP: 002b:00007f82e57370f8 EFLAGS: 00000206 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 0000000000008011 RCX: 00007f82e81c1b62
RDX: 0000000000000003 RSI: 0000000000200000 RDI: 0000000020ffc000
RBP: 0000000020ffc000 R08: 0000000000000008 R09: 0000000010000000
R10: 0000000000008011 R11: 0000000000000206 R12: 0000000020000300
R13: 0000000020ffc000 R14: 0000000020000200 R15: 0000000020ffe000
Allocated by task 297:
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 84:
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
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
The buggy address belongs to the object at ffff88801b62f828
which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 0 bytes inside of
168-byte region [ffff88801b62f828, ffff88801b62f8d0)
The buggy address belongs to the physical page:
page:0000000087ea8829 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b62f
flags: 0x100000000000200(slab|node=0|zone=1)
raw: 0100000000000200 0000000000000000 dead000000000122 ffff8880080718c0
raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88801b62f700: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
ffff88801b62f780: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
>ffff88801b62f800: fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb
^
ffff88801b62f880: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
ffff88801b62f900: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 7d 04 jge 0x6
2: 72 d8 jb 0xffffffdc
4: 5b pop %rbx
5: 5d pop %rbp
6: 41 5c pop %r12
8: 41 5d pop %r13
a: c3 retq
b: 48 c7 c7 40 94 8e 85 mov $0xffffffff858e9440,%rdi
12: e8 cf 12 66 00 callq 0x6612e6
17: eb e3 jmp 0xfffffffc
19: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1)
20: 00 00 00 00
24: 66 90 xchg %ax,%ax
26: 41 57 push %r15
* 28: 41 56 push %r14 <-- trapping instruction
2a: 41 55 push %r13
2c: 49 bd 00 00 00 00 00 movabs $0xdffffc0000000000,%r13
33: fc ff df
36: 41 54 push %r12
38: 55 push %rbp
39: 48 rex.W
3a: c7 .byte 0xc7
3b: c5 .byte 0xc5
3c: c0 .byte 0xc0
3d: 72 .byte 0x72