[syzbot] [kernfs?] KASAN: slab-use-after-free Read in kernfs_new_node

2 views
Skip to first unread message

syzbot

unread,
1:07 AM (6 hours ago) 1:07 AM
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, t...@kernel.org
Hello,

syzbot found the following issue on:

HEAD commit: 67a454e6b1c6 Merge tag 'memblock-6.19-rc1' of git://git.ke..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11438ec2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8750900a7c493a0b
dashboard link: https://syzkaller.appspot.com/bug?extid=9af8471255ac36e34fd4
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ce07389f93b8/disk-67a454e6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/31b4e74f868a/vmlinux-67a454e6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9a4287e94d18/bzImage-67a454e6.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9af847...@syzkaller.appspotmail.com

usb 3-1: Direct firmware load for ueagle-atm/eagleII.fw failed with error -2
usb 3-1: Falling back to sysfs fallback for: ueagle-atm/eagleII.fw
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
BUG: KASAN: slab-use-after-free in kernfs_get fs/kernfs/dir.c:537 [inline]
BUG: KASAN: slab-use-after-free in kernfs_new_node+0x120/0x210 fs/kernfs/dir.c:719
Read of size 4 at addr ffff88806684a960 by task kworker/1:10/8396

CPU: 1 UID: 0 PID: 8396 Comm: kworker/1:10 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Workqueue: events request_firmware_work_func
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xca/0x240 mm/kasan/report.c:482
kasan_report+0x118/0x150 mm/kasan/report.c:595
check_region_inline mm/kasan/generic.c:-1 [inline]
kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:200
instrument_atomic_read include/linux/instrumented.h:68 [inline]
atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
kernfs_get fs/kernfs/dir.c:537 [inline]
kernfs_new_node+0x120/0x210 fs/kernfs/dir.c:719
kernfs_create_dir_ns+0x44/0x130 fs/kernfs/dir.c:1086
sysfs_create_dir_ns+0x123/0x280 fs/sysfs/dir.c:59
create_dir lib/kobject.c:73 [inline]
kobject_add_internal+0x6b1/0xcd0 lib/kobject.c:240
kobject_add_varg lib/kobject.c:374 [inline]
kobject_add+0x155/0x220 lib/kobject.c:426
class_dir_create_and_add drivers/base/core.c:3232 [inline]
get_device_parent+0x31d/0x3a0 drivers/base/core.c:3283
device_add+0x2e1/0xb80 drivers/base/core.c:3613
fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:86 [inline]
fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:162 [inline]
firmware_fallback_sysfs+0x2e4/0xa40 drivers/base/firmware_loader/fallback.c:238
_request_firmware+0xfa4/0x1680 drivers/base/firmware_loader/main.c:898
request_firmware_work_func+0xaf/0x1c0 drivers/base/firmware_loader/main.c:1150
process_one_work kernel/workqueue.c:3257 [inline]
process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421
kthread+0x711/0x8a0 kernel/kthread.c:463
ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246
</TASK>

Allocated by task 44:
kasan_save_stack mm/kasan/common.c:56 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:77
unpoison_slab_object mm/kasan/common.c:339 [inline]
__kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:365
kasan_slab_alloc include/linux/kasan.h:252 [inline]
slab_post_alloc_hook mm/slub.c:4948 [inline]
slab_alloc_node mm/slub.c:5258 [inline]
kmem_cache_alloc_noprof+0x18d/0x6c0 mm/slub.c:5265
__kernfs_new_node+0xdc/0x900 fs/kernfs/dir.c:637
kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:716
kernfs_create_dir_ns+0x44/0x130 fs/kernfs/dir.c:1086
sysfs_create_dir_ns+0x123/0x280 fs/sysfs/dir.c:59
create_dir lib/kobject.c:73 [inline]
kobject_add_internal+0x6b1/0xcd0 lib/kobject.c:240
kobject_add_varg lib/kobject.c:374 [inline]
kobject_add+0x155/0x220 lib/kobject.c:426
device_add+0x408/0xb80 drivers/base/core.c:3627
usb_new_device+0xa29/0x1710 drivers/usb/core/hub.c:2695
hub_port_connect drivers/usb/core/hub.c:5567 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5707 [inline]
port_event drivers/usb/core/hub.c:5871 [inline]
hub_event+0x29de/0x4f30 drivers/usb/core/hub.c:5953
process_one_work kernel/workqueue.c:3257 [inline]
process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421
kthread+0x711/0x8a0 kernel/kthread.c:463
ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246

Freed by task 28:
kasan_save_stack mm/kasan/common.c:56 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:77
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:252 [inline]
__kasan_slab_free+0x5c/0x80 mm/kasan/common.c:284
kasan_slab_free include/linux/kasan.h:234 [inline]
slab_free_hook mm/slub.c:2540 [inline]
slab_free mm/slub.c:6663 [inline]
kmem_cache_free+0x18f/0x8d0 mm/slub.c:6774
rcu_do_batch kernel/rcu/tree.c:2605 [inline]
rcu_core kernel/rcu/tree.c:2857 [inline]
rcu_cpu_kthread+0xc96/0x1c40 kernel/rcu/tree.c:2945
smpboot_thread_fn+0x542/0xa60 kernel/smpboot.c:160
kthread+0x711/0x8a0 kernel/kthread.c:463
ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246

Last potentially related work creation:
kasan_save_stack+0x3e/0x60 mm/kasan/common.c:56
kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:556
__call_rcu_common kernel/rcu/tree.c:3119 [inline]
call_rcu+0x157/0x9c0 kernel/rcu/tree.c:3239
kernfs_put+0x191/0x470 fs/kernfs/dir.c:591
sysfs_put include/linux/sysfs.h:808 [inline]
__kobject_del+0xe9/0x330 lib/kobject.c:605
kobject_del+0x45/0x60 lib/kobject.c:627
device_del+0x763/0x8e0 drivers/base/core.c:3898
usb_disconnect+0x5fb/0x970 drivers/usb/core/hub.c:2376
hub_port_connect drivers/usb/core/hub.c:5407 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5707 [inline]
port_event drivers/usb/core/hub.c:5871 [inline]
hub_event+0x1cd9/0x4f30 drivers/usb/core/hub.c:5953
process_one_work kernel/workqueue.c:3257 [inline]
process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421
kthread+0x711/0x8a0 kernel/kthread.c:463
ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246

The buggy address belongs to the object at ffff88806684a960
which belongs to the cache kernfs_node_cache of size 176
The buggy address is located 0 bytes inside of
freed 176-byte region [ffff88806684a960, ffff88806684aa10)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6684a
ksm flags: 0x80000000000000(node=0|zone=1)
page_type: f5(slab)
raw: 0080000000000000 ffff88801aaf1000 ffffea00012100c0 dead000000000007
raw: 0000000000000000 0000000000110011 00000000f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5654, tgid 5654 (kworker/0:3), ts 200152700934, free_ts 199911155229
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x234/0x290 mm/page_alloc.c:1846
prep_new_page mm/page_alloc.c:1854 [inline]
get_page_from_freelist+0x28c0/0x2960 mm/page_alloc.c:3915
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5210
alloc_pages_mpol+0xd1/0x380 mm/mempolicy.c:2486
alloc_slab_page mm/slub.c:3075 [inline]
allocate_slab+0x86/0x3b0 mm/slub.c:3248
new_slab mm/slub.c:3302 [inline]
___slab_alloc+0xb10/0x1400 mm/slub.c:4651
__slab_alloc+0xc6/0x1f0 mm/slub.c:4774
__slab_alloc_node mm/slub.c:4850 [inline]
slab_alloc_node mm/slub.c:5246 [inline]
kmem_cache_alloc_noprof+0x101/0x6c0 mm/slub.c:5265
__kernfs_new_node+0xdc/0x900 fs/kernfs/dir.c:637
kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:716
__kernfs_create_file+0x4b/0x2e0 fs/kernfs/file.c:1057
sysfs_add_file_mode_ns+0x238/0x300 fs/sysfs/file.c:313
create_files fs/sysfs/group.c:82 [inline]
internal_create_group+0x667/0x1170 fs/sysfs/group.c:189
internal_create_groups fs/sysfs/group.c:229 [inline]
sysfs_create_groups+0x59/0x120 fs/sysfs/group.c:255
device_add_groups drivers/base/core.c:2836 [inline]
device_add_attrs+0x1c4/0x5a0 drivers/base/core.c:2911
device_add+0x496/0xb80 drivers/base/core.c:3643
page last free pid 6946 tgid 6946 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0xfe1/0x1170 mm/page_alloc.c:2943
vfree+0x2ad/0x470 mm/vmalloc.c:3466
xskq_destroy+0x40/0x60 net/xdp/xsk_queue.c:64
xsk_release+0x443/0x670 net/xdp/xsk.c:1241
__sock_release net/socket.c:662 [inline]
sock_close+0xc3/0x240 net/socket.c:1455
__fput+0x45b/0xa80 fs/file_table.c:468
task_work_run+0x1d4/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:44 [inline]
exit_to_user_mode_loop+0xff/0x4f0 kernel/entry/common.c:75
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline]
do_syscall_64+0x2e3/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
ffff88806684a800: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb
ffff88806684a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88806684a900: fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb fb
^
ffff88806684a980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88806684aa00: fb fb fc fc fc fc fc fc fc fc 00 00 00 00 00 00
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages