[v5.15] KASAN: use-after-free Read in kernfs_next_descendant_post (3)

2 views
Skip to first unread message

syzbot

unread,
Apr 22, 2025, 9:17:31 AM4/22/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f7347f400572 Linux 5.15.180
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14554c60580000
kernel config: https://syzkaller.appspot.com/x/.config?x=346c19688de58d89
dashboard link: https://syzkaller.appspot.com/bug?extid=b3f32cb52f2a9e45b492
compiler: Debian clang version 15.0.6, Debian LLD 15.0.6

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2685682aa24a/disk-f7347f40.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f01e2fad1237/vmlinux-f7347f40.xz
kernel image: https://storage.googleapis.com/syzbot-assets/cbcd92b62b9a/bzImage-f7347f40.xz

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

usb 4-1: Direct firmware load for ueagle-atm/eagleI.fw failed with error -2
usb 4-1: Falling back to sysfs fallback for: ueagle-atm/eagleI.fw
==================================================================
BUG: KASAN: use-after-free in kernfs_type include/linux/kernfs.h:294 [inline]
BUG: KASAN: use-after-free in kernfs_leftmost_descendant fs/kernfs/dir.c:1251 [inline]
BUG: KASAN: use-after-free in kernfs_next_descendant_post+0x184/0x200 fs/kernfs/dir.c:1282
Read of size 2 at addr ffff88805b32b098 by task kworker/0:6/4222

CPU: 0 PID: 4222 Comm: kworker/0:6 Not tainted 5.15.180-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: events request_firmware_work_func
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
kernfs_type include/linux/kernfs.h:294 [inline]
kernfs_leftmost_descendant fs/kernfs/dir.c:1251 [inline]
kernfs_next_descendant_post+0x184/0x200 fs/kernfs/dir.c:1282
kernfs_activate+0x28/0x200 fs/kernfs/dir.c:1317
kernfs_add_one+0x4f3/0x640 fs/kernfs/dir.c:788
kernfs_create_dir_ns+0xd5/0x120 fs/kernfs/dir.c:1015
sysfs_create_dir_ns+0x185/0x390 fs/sysfs/dir.c:59
create_dir lib/kobject.c:89 [inline]
kobject_add_internal+0x6e0/0xe00 lib/kobject.c:263
kobject_add_varg lib/kobject.c:398 [inline]
kobject_add+0x14e/0x210 lib/kobject.c:450
class_dir_create_and_add drivers/base/core.c:2966 [inline]
get_device_parent+0x391/0x400 drivers/base/core.c:3021
device_add+0x336/0xfd0 drivers/base/core.c:3333
fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:507 [inline]
fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:583 [inline]
firmware_fallback_sysfs+0x3f0/0xc90 drivers/base/firmware_loader/fallback.c:659
_request_firmware+0xc72/0x12c0 drivers/base/firmware_loader/main.c:876
request_firmware_work_func+0x126/0x270 drivers/base/firmware_loader/main.c:1127
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
</TASK>

Allocated by task 4222:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:725 [inline]
__kernfs_new_node+0xdb/0x750 fs/kernfs/dir.c:593
kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:669
kernfs_create_dir_ns+0x3f/0x120 fs/kernfs/dir.c:1005
sysfs_create_dir_ns+0x185/0x390 fs/sysfs/dir.c:59
create_dir lib/kobject.c:89 [inline]
kobject_add_internal+0x6e0/0xe00 lib/kobject.c:263
kobject_add_varg lib/kobject.c:398 [inline]
kobject_add+0x14e/0x210 lib/kobject.c:450
class_dir_create_and_add drivers/base/core.c:2966 [inline]
get_device_parent+0x391/0x400 drivers/base/core.c:3021
device_add+0x336/0xfd0 drivers/base/core.c:3333
fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:507 [inline]
fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:583 [inline]
firmware_fallback_sysfs+0x3f0/0xc90 drivers/base/firmware_loader/fallback.c:659
_request_firmware+0xc72/0x12c0 drivers/base/firmware_loader/main.c:876
request_firmware_work_func+0x126/0x270 drivers/base/firmware_loader/main.c:1127
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 5779:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
kernfs_put+0x325/0x4a0 fs/kernfs/dir.c:547
__kernfs_remove+0x99e/0xc80 fs/kernfs/dir.c:1393
kernfs_remove+0x1d/0x30 fs/kernfs/dir.c:1406
__kobject_del+0xe2/0x310 lib/kobject.c:628
kobject_del+0x41/0x60 lib/kobject.c:651
device_del+0x9fe/0xbd0 drivers/base/core.c:3612
usb_disconnect+0x58f/0x8c0 drivers/usb/core/hub.c:2285
hub_port_connect drivers/usb/core/hub.c:5311 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5607 [inline]
port_event drivers/usb/core/hub.c:5753 [inline]
hub_event+0x1d58/0x54c0 drivers/usb/core/hub.c:5835
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
process_scheduled_works kernel/workqueue.c:2373 [inline]
worker_thread+0xdcf/0x1280 kernel/workqueue.c:2459
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88805b32b000
which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 152 bytes inside of
168-byte region [ffff88805b32b000, ffff88805b32b0a8)
The buggy address belongs to the page:
page:ffffea00016ccac0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b32b
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 0000000a00000001 ffff8880175eab40
raw: 0000000000000000 0000000000110011 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 5897, ts 191745008918, free_ts 190337274672
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
__alloc_pages+0x272/0x700 mm/page_alloc.c:5466
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:725 [inline]
__kernfs_new_node+0xdb/0x750 fs/kernfs/dir.c:593
kernfs_new_node+0x136/0x230 fs/kernfs/dir.c:669
__kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:985
sysfs_add_file_mode_ns+0x308/0x3e0 fs/sysfs/file.c:317
create_files fs/sysfs/group.c:64 [inline]
internal_create_group+0x573/0xf00 fs/sysfs/group.c:149
internal_create_groups fs/sysfs/group.c:189 [inline]
sysfs_create_groups+0x52/0x110 fs/sysfs/group.c:215
create_dir lib/kobject.c:100 [inline]
kobject_add_internal+0x83b/0xe00 lib/kobject.c:263
kobject_add_varg lib/kobject.c:398 [inline]
kobject_init_and_add+0x120/0x190 lib/kobject.c:481
ext4_register_sysfs+0xb2/0x2b0 fs/ext4/sysfs.c:529
ext4_fill_super+0x942e/0xa110 fs/ext4/super.c:4950
mount_bdev+0x2c9/0x3f0 fs/super.c:1400
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
kasan_depopulate_vmalloc_pte+0x66/0x80 mm/kasan/shadow.c:375
apply_to_pte_range mm/memory.c:2573 [inline]
apply_to_pmd_range mm/memory.c:2617 [inline]
apply_to_pud_range mm/memory.c:2653 [inline]
apply_to_p4d_range mm/memory.c:2689 [inline]
__apply_to_page_range+0x9bf/0xcc0 mm/memory.c:2725
kasan_release_vmalloc+0x96/0xb0 mm/kasan/shadow.c:485
__purge_vmap_area_lazy+0x15ae/0x1740 mm/vmalloc.c:1704
_vm_unmap_aliases+0x453/0x4e0 mm/vmalloc.c:2107
vm_remove_mappings mm/vmalloc.c:2584 [inline]
__vunmap+0x71b/0xa50 mm/vmalloc.c:2611
bpf_jit_binary_free kernel/bpf/core.c:918 [inline]
bpf_jit_free+0x92/0x180 kernel/bpf/core.c:931
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
ffff88805b32af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88805b32b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805b32b080: fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb
^
ffff88805b32b100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805b32b180: fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb
==================================================================


---
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

syzbot

unread,
Jul 31, 2025, 9:17:31 AM7/31/25
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages