syzbot


KASAN: slab-use-after-free Read in radix_tree_next_chunk

Status: moderation: reported on 2025/08/02 20:03
Subsystems: afs
[Documentation on labels]
Reported-by: syzbot+cf6dfe6afe9254002996@syzkaller.appspotmail.com
First crash: 100d, last: 9d05h
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in radix_tree_next_chunk 19 C 465 996d 2131d 0/1 upstream: reported C repro on 2020/01/06 15:45

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in radix_tree_next_chunk+0x385/0xb60 lib/radix-tree.c:1208
Read of size 8 at addr ffff8880229a7750 by task syz.4.300/7417

CPU: 1 UID: 0 PID: 7417 Comm: syz.4.300 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
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
 radix_tree_next_chunk+0x385/0xb60 lib/radix-tree.c:1208
 idr_get_next_ul lib/idr.c:236 [inline]
 idr_get_next+0x17a/0x340 lib/idr.c:267
 afs_dynroot_readdir_cells fs/afs/dynroot.c:293 [inline]
 afs_dynroot_readdir+0x520/0x9a0 fs/afs/dynroot.c:352
 iterate_dir+0x399/0x570 fs/readdir.c:108
 __do_sys_getdents fs/readdir.c:326 [inline]
 __se_sys_getdents+0xe4/0x250 fs/readdir.c:312
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe29338efc9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe294198038 EFLAGS: 00000246 ORIG_RAX: 000000000000004e
RAX: ffffffffffffffda RBX: 00007fe2935e6180 RCX: 00007fe29338efc9
RDX: 00000000000000ad RSI: 0000200000000100 RDI: 0000000000000004
RBP: 00007fe293411f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe2935e6218 R14: 00007fe2935e6180 R15: 00007ffd5a54b928
 </TASK>

Allocated by task 7417:
 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:342 [inline]
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:368
 kasan_slab_alloc include/linux/kasan.h:252 [inline]
 slab_post_alloc_hook mm/slub.c:4970 [inline]
 slab_alloc_node mm/slub.c:5280 [inline]
 kmem_cache_alloc_noprof+0x367/0x6e0 mm/slub.c:5287
 radix_tree_node_alloc+0x7e/0x3a0 lib/radix-tree.c:276
 idr_get_free+0x2b3/0xa70 lib/radix-tree.c:1506
 idr_alloc_u32+0x159/0x2d0 lib/idr.c:46
 idr_alloc_cyclic+0x9b/0x1b0 lib/idr.c:125
 afs_alloc_cell fs/afs/cell.c:203 [inline]
 afs_lookup_cell+0xf61/0x1860 fs/afs/cell.c:265
 afs_dynroot_lookup_cell fs/afs/dynroot.c:111 [inline]
 afs_dynroot_lookup+0x27a/0x8c0 fs/afs/dynroot.c:159
 lookup_open fs/namei.c:3774 [inline]
 open_last_lookups fs/namei.c:3895 [inline]
 path_openat+0x1101/0x3830 fs/namei.c:4131
 do_filp_open+0x1fa/0x410 fs/namei.c:4161
 do_sys_openat2+0x121/0x1c0 fs/open.c:1437
 do_sys_open fs/open.c:1452 [inline]
 __do_sys_open fs/open.c:1460 [inline]
 __se_sys_open fs/open.c:1456 [inline]
 __x64_sys_open+0x11e/0x150 fs/open.c:1456
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 7419:
 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:587
 kasan_save_free_info mm/kasan/kasan.h:406 [inline]
 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:2539 [inline]
 slab_free mm/slub.c:6630 [inline]
 kmem_cache_free+0x19b/0x690 mm/slub.c:6740
 rcu_do_batch kernel/rcu/tree.c:2605 [inline]
 rcu_core+0xcab/0x1770 kernel/rcu/tree.c:2861
 handle_softirqs+0x286/0x870 kernel/softirq.c:622
 __do_softirq kernel/softirq.c:656 [inline]
 invoke_softirq kernel/softirq.c:496 [inline]
 __irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:723
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1052 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1052
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697

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:559
 __call_rcu_common kernel/rcu/tree.c:3123 [inline]
 call_rcu+0x157/0x9c0 kernel/rcu/tree.c:3243
 radix_tree_node_free lib/radix-tree.c:310 [inline]
 delete_node+0x1b6/0xa50 lib/radix-tree.c:573
 radix_tree_delete_item+0x2b6/0x400 lib/radix-tree.c:1430
 afs_cell_destroy+0x16f/0x2c0 fs/afs/cell.c:523
 rcu_do_batch kernel/rcu/tree.c:2605 [inline]
 rcu_core+0xcab/0x1770 kernel/rcu/tree.c:2861
 handle_softirqs+0x286/0x870 kernel/softirq.c:622
 __do_softirq kernel/softirq.c:656 [inline]
 invoke_softirq kernel/softirq.c:496 [inline]
 __irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:723
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1052 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1052
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697

The buggy address belongs to the object at ffff8880229a7700
 which belongs to the cache radix_tree_node of size 576
The buggy address is located 80 bytes inside of
 freed 576-byte region [ffff8880229a7700, ffff8880229a7940)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x229a4
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880550a0001
ksm flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801a070000 ffffea000093f500 dead000000000003
raw: 0000000000000000 0000000080170017 00000000f5000000 ffff8880550a0001
head: 00fff00000000040 ffff88801a070000 ffffea000093f500 dead000000000003
head: 0000000000000000 0000000080170017 00000000f5000000 ffff8880550a0001
head: 00fff00000000002 ffffea00008a6901 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x52810(GFP_NOWAIT|__GFP_RECLAIMABLE|__GFP_NORETRY|__GFP_COMP), pid 5827, tgid 5827 (syz-executor), ts 92740076725, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1850
 prep_new_page mm/page_alloc.c:1858 [inline]
 get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3884
 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5183
 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
 alloc_slab_page mm/slub.c:3055 [inline]
 allocate_slab+0x96/0x350 mm/slub.c:3228
 new_slab mm/slub.c:3282 [inline]
 ___slab_alloc+0xe94/0x18a0 mm/slub.c:4651
 __slab_alloc+0x65/0x100 mm/slub.c:4770
 __slab_alloc_node mm/slub.c:4846 [inline]
 slab_alloc_node mm/slub.c:5268 [inline]
 kmem_cache_alloc_lru_noprof+0x3ef/0x6d0 mm/slub.c:5299
 xas_alloc lib/xarray.c:378 [inline]
 xas_create+0x116b/0x1b90 lib/xarray.c:685
 xas_store+0x95/0x1880 lib/xarray.c:795
 __xa_store+0xe9/0x210 lib/xarray.c:1703
 xa_store_irq include/linux/xarray.h:623 [inline]
 ref_tracker_dir_debugfs+0x1c4/0x270 lib/ref_tracker.c:447
 ref_tracker_dir_init include/linux/ref_tracker.h:70 [inline]
 alloc_netdev_mqs+0x272/0x11b0 net/core/dev.c:11907
 rtnl_create_link+0x31f/0xd10 net/core/rtnetlink.c:3641
 rtnl_newlink_create+0x25c/0xb00 net/core/rtnetlink.c:3823
 __rtnl_newlink net/core/rtnetlink.c:3950 [inline]
 rtnl_newlink+0x16e4/0x1c80 net/core/rtnetlink.c:4065
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880229a7600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880229a7680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880229a7700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8880229a7780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880229a7800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/29 00:14 upstream 8eefed8f65cc fd2207e7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in radix_tree_next_chunk
2025/10/04 02:39 upstream 9b0d551bcc05 49379ee0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in radix_tree_next_chunk
2025/07/29 19:59 upstream ced1b9e0392d ba28e0a8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in radix_tree_next_chunk
* Struck through repros no longer work on HEAD.