==================================================================
BUG: KASAN: use-after-free in kernfs_root fs/kernfs/kernfs-internal.h:66 [inline]
BUG: KASAN: use-after-free in kernfs_find_and_get_ns+0x3d/0x110 fs/kernfs/dir.c:903
Read of size 8 at addr ffff8881204cf008 by task kworker/1:5/385
CPU: 1 PID: 385 Comm: kworker/1:5 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Workqueue: events flush_stashed_error_work
Call Trace:
<TASK>
__dump_stack+0x21/0x24 lib/dump_stack.c:88
dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
print_address_description+0x71/0x200 mm/kasan/report.c:316
print_report+0x4a/0x60 mm/kasan/report.c:420
kasan_report+0x122/0x150 mm/kasan/report.c:524
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
kernfs_root fs/kernfs/kernfs-internal.h:66 [inline]
kernfs_find_and_get_ns+0x3d/0x110 fs/kernfs/dir.c:903
kernfs_find_and_get include/linux/kernfs.h:614 [inline]
sysfs_notify+0x71/0xd0 fs/sysfs/file.c:190
ext4_notify_error_sysfs+0x25/0x30 fs/ext4/sysfs.c:518
flush_stashed_error_work+0x2cb/0x2f0 fs/ext4/super.c:-1
process_one_work+0x71f/0xc40 kernel/workqueue.c:2302
worker_thread+0xa29/0x11f0 kernel/workqueue.c:2449
kthread+0x281/0x320 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>
Allocated by task 2009:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505
__kasan_slab_alloc+0x72/0x80 mm/kasan/common.c:333
kasan_slab_alloc include/linux/kasan.h:202 [inline]
slab_post_alloc_hook+0x4f/0x2d0 mm/slab.h:768
slab_alloc_node mm/slub.c:3382 [inline]
slab_alloc mm/slub.c:3392 [inline]
__kmem_cache_alloc_lru mm/slub.c:3399 [inline]
kmem_cache_alloc+0x16e/0x330 mm/slub.c:3408
kmem_cache_zalloc include/linux/slab.h:689 [inline]
__kernfs_new_node+0xdb/0x680 fs/kernfs/dir.c:614
kernfs_new_node+0x150/0x260 fs/kernfs/dir.c:690
kernfs_create_dir_ns+0x47/0x130 fs/kernfs/dir.c:1046
sysfs_create_dir_ns+0x11c/0x280 fs/sysfs/dir.c:59
create_dir lib/kobject.c:63 [inline]
kobject_add_internal+0x6fc/0xc20 lib/kobject.c:231
kobject_add_varg lib/kobject.c:366 [inline]
kobject_init_and_add+0x122/0x190 lib/kobject.c:449
ext4_register_sysfs+0xbb/0x2c0 fs/ext4/sysfs.c:531
__ext4_fill_super fs/ext4/super.c:5500 [inline]
ext4_fill_super+0x6e14/0x7970 fs/ext4/super.c:5655
get_tree_bdev+0x444/0x680 fs/super.c:1368
ext4_get_tree+0x1c/0x20 fs/ext4/super.c:5685
vfs_get_tree+0x9a/0x270 fs/super.c:1575
do_new_mount+0x25a/0xa20 fs/namespace.c:3069
path_mount+0x675/0x1010 fs/namespace.c:3399
do_mount fs/namespace.c:3412 [inline]
__do_sys_mount fs/namespace.c:3620 [inline]
__se_sys_mount+0x318/0x380 fs/namespace.c:3597
__x64_sys_mount+0xbf/0xd0 fs/namespace.c:3597
x64_sys_call+0x65d/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:166
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 683:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x31/0x50 mm/kasan/generic.c:516
____kasan_slab_free+0x132/0x180 mm/kasan/common.c:241
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
kasan_slab_free include/linux/kasan.h:178 [inline]
slab_free_hook mm/slub.c:1750 [inline]
slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1776
slab_free mm/slub.c:3712 [inline]
kmem_cache_free+0x12d/0x300 mm/slub.c:3737
kernfs_put+0x310/0x480 fs/kernfs/dir.c:568
sysfs_put include/linux/sysfs.h:657 [inline]
__kobject_del+0xf8/0x2f0 lib/kobject.c:597
kobject_del+0x45/0x60 lib/kobject.c:619
ext4_unregister_sysfs+0x91/0xa0 fs/ext4/sysfs.c:565
ext4_put_super+0x73/0xac0 fs/ext4/super.c:1216
generic_shutdown_super+0x15f/0x370 fs/super.c:503
kill_block_super+0x7f/0xf0 fs/super.c:1472
deactivate_locked_super+0xb5/0x120 fs/super.c:334
deactivate_super+0xaf/0xe0 fs/super.c:365
cleanup_mnt+0x45f/0x4e0 fs/namespace.c:1182
__cleanup_mnt+0x19/0x20 fs/namespace.c:1189
task_work_run+0x1db/0x240 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0x9b/0xb0 kernel/entry/common.c:177
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:303
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff8881204cf000
which belongs to the cache kernfs_node_cache of size 136
The buggy address is located 8 bytes inside of
136-byte region [ffff8881204cf000, ffff8881204cf088)
The buggy address belongs to the physical page:
page:ffffea00048133c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1204cf
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004c2ed00 dead000000000007 ffff8881001ed800
raw: 0000000000000000 0000000000140014 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 878, tgid 878 (kworker/0:6), ts 56195710050, free_ts 56188211296
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2643
prep_new_page+0x1c/0x110 mm/page_alloc.c:2650
get_page_from_freelist+0x2c7b/0x2cf0 mm/page_alloc.c:4554
__alloc_pages+0x1c3/0x450 mm/page_alloc.c:5868
alloc_slab_page+0x6e/0xf0 include/linux/gfp.h:-1
allocate_slab mm/slub.c:1967 [inline]
new_slab+0x98/0x3d0 mm/slub.c:2020
___slab_alloc+0x6bd/0xb20 mm/slub.c:3177
__slab_alloc+0x5e/0xa0 mm/slub.c:3263
slab_alloc_node mm/slub.c:3348 [inline]
slab_alloc mm/slub.c:3392 [inline]
__kmem_cache_alloc_lru mm/slub.c:3399 [inline]
kmem_cache_alloc+0x1b0/0x330 mm/slub.c:3408
kmem_cache_zalloc include/linux/slab.h:689 [inline]
__kernfs_new_node+0xdb/0x680 fs/kernfs/dir.c:614
kernfs_new_node+0x150/0x260 fs/kernfs/dir.c:690
__kernfs_create_file+0x4e/0x270 fs/kernfs/file.c:1050
sysfs_add_file_mode_ns+0x1ce/0x270 fs/sysfs/file.c:294
sysfs_merge_group+0x174/0x300 fs/sysfs/group.c:342
dpm_sysfs_add+0xe0/0x290 drivers/base/power/sysfs.c:707
device_add+0x6ce/0xef0 drivers/base/core.c:3655
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1551 [inline]
free_pcp_prepare mm/page_alloc.c:1625 [inline]
free_unref_page_prepare+0x742/0x750 mm/page_alloc.c:3589
free_unref_page+0x8f/0x530 mm/page_alloc.c:3687
free_the_page mm/page_alloc.c:836 [inline]
__free_pages+0x67/0x100 mm/page_alloc.c:5957
free_pages+0x82/0x90 mm/page_alloc.c:5968
selinux_genfs_get_sid+0x20b/0x250 security/selinux/hooks.c:1309
inode_doinit_with_dentry+0x86e/0xd70 security/selinux/hooks.c:1504
selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6396
security_d_instantiate+0xb3/0x110 security/security.c:2096
d_splice_alias+0x6d/0x390 fs/dcache.c:3153
kernfs_iop_lookup+0x2c2/0x310 fs/kernfs/dir.c:1204
__lookup_slow+0x2c7/0x3f0 fs/namei.c:1689
lookup_slow+0x57/0x70 fs/namei.c:1706
walk_component+0x2f4/0x420 fs/namei.c:1997
lookup_last fs/namei.c:2454 [inline]
path_lookupat+0x180/0x490 fs/namei.c:2478
filename_lookup+0x1f0/0x500 fs/namei.c:2507
vfs_statx+0x10b/0x660 fs/stat.c:229
Memory state around the buggy address:
ffff8881204cef00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8881204cef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881204cf000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881204cf080: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb
ffff8881204cf100: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
==================================================================
general protection fault, probably for non-canonical address 0xe0eabc2b0000005f: 0000 [#1] PREEMPT SMP KASAN
KASAN: maybe wild-memory-access in range [0x07560158000002f8-0x07560158000002ff]
CPU: 1 PID: 385 Comm: kworker/1:5 Tainted: G B syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Workqueue: events flush_stashed_error_work
RIP: 0010:kernfs_root fs/kernfs/kernfs-internal.h:68 [inline]
RIP: 0010:kernfs_find_and_get_ns+0x54/0x110 fs/kernfs/dir.c:903
Code: 48 89 f8 48 c1 e8 03 42 80 3c 28 00 74 05 e8 03 64 d6 ff 49 8b 5c 24 08 48 85 db 49 0f 44 dc 48 83 c3 50 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 dd 63 d6 ff 48 8b 1b 48 83 c3 60
RSP: 0018:ffffc9000e7c7c60 EFLAGS: 00010206
RAX: 00eac02b0000005f RBX: 07560158000002fb RCX: ffff888113e73cc0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc9000e7c7c88 R08: dffffc0000000000 R09: fffffbfff0f2d8fd
R10: fffffbfff0f2d8fd R11: 1ffffffff0f2d8fc R12: ffff8881204cf000
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffffff8594ca20
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f53c2f17d60 CR3: 0000000131a35000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
kernfs_find_and_get include/linux/kernfs.h:614 [inline]
sysfs_notify+0x71/0xd0 fs/sysfs/file.c:190
ext4_notify_error_sysfs+0x25/0x30 fs/ext4/sysfs.c:518
flush_stashed_error_work+0x2cb/0x2f0 fs/ext4/super.c:-1
process_one_work+0x71f/0xc40 kernel/workqueue.c:2302
worker_thread+0xa29/0x11f0 kernel/workqueue.c:2449
kthread+0x281/0x320 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:kernfs_root fs/kernfs/kernfs-internal.h:68 [inline]
RIP: 0010:kernfs_find_and_get_ns+0x54/0x110 fs/kernfs/dir.c:903
Code: 48 89 f8 48 c1 e8 03 42 80 3c 28 00 74 05 e8 03 64 d6 ff 49 8b 5c 24 08 48 85 db 49 0f 44 dc 48 83 c3 50 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 dd 63 d6 ff 48 8b 1b 48 83 c3 60
RSP: 0018:ffffc9000e7c7c60 EFLAGS: 00010206
RAX: 00eac02b0000005f RBX: 07560158000002fb RCX: ffff888113e73cc0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc9000e7c7c88 R08: dffffc0000000000 R09: fffffbfff0f2d8fd
R10: fffffbfff0f2d8fd R11: 1ffffffff0f2d8fc R12: ffff8881204cf000
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffffff8594ca20
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f53c2f17d60 CR3: 000000012f4da000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 48 89 f8 mov %rdi,%rax
3: 48 c1 e8 03 shr $0x3,%rax
7: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1)
c: 74 05 je 0x13
e: e8 03 64 d6 ff call 0xffd66416
13: 49 8b 5c 24 08 mov 0x8(%r12),%rbx
18: 48 85 db test %rbx,%rbx
1b: 49 0f 44 dc cmove %r12,%rbx
1f: 48 83 c3 50 add $0x50,%rbx
23: 48 89 d8 mov %rbx,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction
2f: 74 08 je 0x39
31: 48 89 df mov %rbx,%rdi
34: e8 dd 63 d6 ff call 0xffd66416
39: 48 8b 1b mov (%rbx),%rbx
3c: 48 83 c3 60 add $0x60,%rbx