KASAN: use-after-free Read in kernfs_new_node (2)

Status: upstream: reported on 2026/11/26 16:32
Reported-by: syzbot+5692f978420a5fcc7698@syzkaller.appspotmail.com
First crash: 11h50m, last: 11h50m
▶ ▼ Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in kernfs_new_node 19 1 490d 490d 0/3 auto-obsoleted due to no activity on 2025/11/01 08:19
upstream KASAN: slab-use-after-free Read in kernfs_new_node (2) actionable prio:high kernfs 19 3 196d 180d 0/30 auto-obsoleted due to no activity on 2026/08/22 10:12
upstream KASAN: slab-use-after-free Read in kernfs_new_node kernfs 19 1 353d 349d 0/30 auto-obsoleted due to no activity on 2026/03/18 05:27

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:72 [inline]
BUG: KASAN: use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline]
BUG: KASAN: use-after-free in kernfs_get fs/kernfs/dir.c:525 [inline]
BUG: KASAN: use-after-free in kernfs_new_node+0x166/0x250 fs/kernfs/dir.c:693
Read of size 4 at addr ffff88802d37cd98 by task syz.3.763/7661

CPU: 1 PID: 7661 Comm: syz.3.763 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:420
 kasan_report+0x10b/0x140 mm/kasan/report.c:524
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x235/0x290 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:72 [inline]
 atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline]
 kernfs_get fs/kernfs/dir.c:525 [inline]
 kernfs_new_node+0x166/0x250 fs/kernfs/dir.c:693
 __kernfs_create_file+0x47/0x2e0 fs/kernfs/file.c:1068
 sysfs_add_file_mode_ns+0x233/0x2f0 fs/sysfs/file.c:298
 sysfs_create_file_ns+0x128/0x1b0 fs/sysfs/file.c:359
 rfcomm_dev_add net/bluetooth/rfcomm/tty.c:345 [inline]
 __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:424 [inline]
 rfcomm_create_dev net/bluetooth/rfcomm/tty.c:480 [inline]
 rfcomm_dev_ioctl+0x191a/0x1d10 net/bluetooth/rfcomm/tty.c:582
 sock_do_ioctl+0xfb/0x320 net/socket.c:1202
 sock_ioctl+0x48a/0x700 net/socket.c:1321
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f61125a9a99
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f61134ca028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f6112835fa0 RCX: 00007f61125a9a99
RDX: 0000200000000000 RSI: 00000000400452c8 RDI: 0000000000000005
RBP: 00007f611263918b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6112836038 R14: 00007f6112835fa0 R15: 00007ffc452d82f8
 </TASK>

Allocated by task 7661:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
 __kasan_slab_alloc+0x6b/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x490 mm/slab.h:742
 slab_alloc_node mm/slub.c:3366 [inline]
 slab_alloc mm/slub.c:3374 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3381 [inline]
 kmem_cache_alloc+0x18b/0x2f0 mm/slub.c:3390
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 __kernfs_new_node+0xe1/0x7f0 fs/kernfs/dir.c:614
 kernfs_new_node+0x148/0x250 fs/kernfs/dir.c:690
 kernfs_create_dir_ns+0x40/0x120 fs/kernfs/dir.c:1046
 sysfs_create_dir_ns+0x12c/0x290 fs/sysfs/dir.c:59
 create_dir lib/kobject.c:63 [inline]
 kobject_add_internal+0x617/0xca0 lib/kobject.c:231
 kobject_add_varg lib/kobject.c:366 [inline]
 kobject_add+0x160/0x230 lib/kobject.c:418
 device_add+0x470/0x1050 drivers/base/core.c:3644
 tty_register_device_attr+0x427/0x9a0 drivers/tty/tty_io.c:3268
 rfcomm_dev_add net/bluetooth/rfcomm/tty.c:331 [inline]
 __rfcomm_create_dev net/bluetooth/rfcomm/tty.c:424 [inline]
 rfcomm_create_dev net/bluetooth/rfcomm/tty.c:480 [inline]
 rfcomm_dev_ioctl+0x180c/0x1d10 net/bluetooth/rfcomm/tty.c:582
 sock_do_ioctl+0xfb/0x320 net/socket.c:1202
 sock_ioctl+0x48a/0x700 net/socket.c:1321
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 3641:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0x126/0x1f0 mm/kasan/common.c:237
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1735 [inline]
 slab_free_freelist_hook+0x133/0x1b0 mm/slub.c:1761
 slab_free mm/slub.c:3694 [inline]
 kmem_cache_free+0xf7/0x2a0 mm/slub.c:3716
 kernfs_put+0x311/0x480 fs/kernfs/dir.c:568
 evict+0x4b2/0x9d0 fs/inode.c:702
 __dentry_kill+0x401/0x800 fs/dcache.c:611
 dentry_kill+0xb8/0x290 fs/dcache.c:-1
 dput+0xfa/0x1d0 fs/dcache.c:918
 lookup_fast+0x306/0x4c0 fs/namei.c:1664
 walk_component fs/namei.c:2002 [inline]
 link_path_walk+0x608/0xea0 fs/namei.c:2333
 path_openat+0x285/0x2f10 fs/namei.c:3834
 do_filp_open+0x1ee/0x420 fs/namei.c:3865
 do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
 do_sys_open fs/open.c:1336 [inline]
 __do_sys_openat fs/open.c:1352 [inline]
 __se_sys_openat fs/open.c:1347 [inline]
 __x64_sys_openat+0x135/0x160 fs/open.c:1347
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88802d37cd98
 which belongs to the cache kernfs_node_cache of size 168
The buggy address is located 0 bytes inside of
 168-byte region [ffff88802d37cd98, ffff88802d37ce40)

The buggy address belongs to the physical page:
page:ffffea0000b4df00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2d37c
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888140008c80
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 129, tgid 129 (kworker/1:2), ts 352659993265, free_ts 352579064864
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2561
 prep_new_page mm/page_alloc.c:2568 [inline]
 get_page_from_freelist+0x208b/0x21a0 mm/page_alloc.c:4368
 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5668
 alloc_slab_page+0x5d/0x180 mm/slub.c:1805
 allocate_slab mm/slub.c:1950 [inline]
 new_slab+0x87/0x2d0 mm/slub.c:2003
 ___slab_alloc+0xbc5/0x1240 mm/slub.c:3161
 __slab_alloc mm/slub.c:3247 [inline]
 slab_alloc_node mm/slub.c:3332 [inline]
 slab_alloc mm/slub.c:3374 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3381 [inline]
 kmem_cache_alloc+0x111/0x2f0 mm/slub.c:3390
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 __kernfs_new_node+0xe1/0x7f0 fs/kernfs/dir.c:614
 kernfs_new_node+0x148/0x250 fs/kernfs/dir.c:690
 __kernfs_create_file+0x47/0x2e0 fs/kernfs/file.c:1068
 sysfs_add_file_mode_ns+0x233/0x2f0 fs/sysfs/file.c:298
 create_files fs/sysfs/group.c:64 [inline]
 internal_create_group+0x490/0xce0 fs/sysfs/group.c:148
 internal_create_groups fs/sysfs/group.c:188 [inline]
 sysfs_create_groups+0x55/0x120 fs/sysfs/group.c:214
 device_add_groups drivers/base/core.c:2764 [inline]
 device_add_attrs+0x1ae/0x830 drivers/base/core.c:2923
 device_add+0x677/0x1050 drivers/base/core.c:3660
 usb_create_ep_devs+0x128/0x220 drivers/usb/core/endpoint.c:169
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1488 [inline]
 free_pcp_prepare mm/page_alloc.c:1538 [inline]
 free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3422
 free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3563
 release_pages+0x20d1/0x2340 mm/swap.c:1035
 tlb_batch_pages_flush mm/mmu_gather.c:60 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:255 [inline]
 tlb_flush_mmu+0x105/0x220 mm/mmu_gather.c:262
 tlb_finish_mmu+0xf0/0x220 mm/mmu_gather.c:394
 exit_mmap+0x388/0x970 mm/mmap.c:3313
 __mmput+0x118/0x3a0 kernel/fork.c:1204
 exit_mm+0x24d/0x350 kernel/exit.c:572
 do_exit+0x958/0x2570 kernel/exit.c:874
 do_group_exit+0x229/0x2e0 kernel/exit.c:1030
 __do_sys_exit_group kernel/exit.c:1041 [inline]
 __se_sys_exit_group kernel/exit.c:1039 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1039
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff88802d37cc80: fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00
 ffff88802d37cd00: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
>ffff88802d37cd80: fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88802d37ce00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88802d37ce80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/26 16:32 linux-6.1.y 1ca1436ccc68 1c78e8c0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in kernfs_new_node
* Struck through repros no longer work on HEAD.