syzbot


KASAN: use-after-free Read in sanity_check_extent_cache

Status: upstream: reported C repro on 2025/03/28 08:10
Bug presence: origin:lts-only
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+ea091fe1a7b823bed2e7@syzkaller.appspotmail.com
First crash: 312d, last: 35d
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2025/12/30 linux-6.1.y (ToT) 50cbba13faa2 C [report] KASAN: use-after-free Read in sanity_check_extent_cache
2025/12/30 upstream (ToT) 8640b74557fc C Didn't crash
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in sanity_check_extent_cache origin:lts 19 C 3 28d 231d 0/2 upstream: reported C repro on 2025/06/17 23:46
upstream KASAN: slab-use-after-free Read in sanity_check_extent_cache f2fs 19 C done 5 602d 645d 27/29 fixed on 2024/08/14 03:44
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2026/01/24 02:32 1m fix candidate upstream error job log
2025/08/19 21:44 1h49m fix candidate upstream OK (0) job log
2025/05/22 07:07 13m bisect fix linux-6.1.y error job log

Sample crash report:
RDX: 0000000002000000 RSI: 00002000000000c0 RDI: ffffffffffffff9c
RBP: 00007fadfa013f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fadfa1e6128 R14: 00007fadfa1e6090 R15: 00007ffc8b166bd8
 </TASK>
==================================================================
BUG: KASAN: use-after-free in sanity_check_extent_cache+0x26b/0x320 fs/f2fs/extent_cache.c:35
Read of size 4 at addr ffff888071af8918 by task syz.0.25/4483

CPU: 0 PID: 4483 Comm: syz.0.25 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e 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
 sanity_check_extent_cache+0x26b/0x320 fs/f2fs/extent_cache.c:35
 do_read_inode fs/f2fs/inode.c:461 [inline]
 f2fs_iget+0x36e9/0x4b30 fs/f2fs/inode.c:512
 f2fs_nfs_get_inode+0x72/0x100 fs/f2fs/super.c:3157
 generic_fh_to_dentry+0x8f/0xe0 fs/libfs.c:1072
 exportfs_decode_fh_raw+0x12a/0x640 fs/exportfs/expfs.c:435
 exportfs_decode_fh+0x36/0x70 fs/exportfs/expfs.c:575
 do_handle_to_path fs/fhandle.c:152 [inline]
 handle_to_path fs/fhandle.c:207 [inline]
 do_handle_open+0x3df/0x810 fs/fhandle.c:223
 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
RIP: 0033:0x7fadf9f8f749
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:00007fadf95dd038 EFLAGS: 00000246 ORIG_RAX: 0000000000000130
RAX: ffffffffffffffda RBX: 00007fadfa1e6090 RCX: 00007fadf9f8f749
RDX: 0000000002000000 RSI: 00002000000000c0 RDI: ffffffffffffff9c
RBP: 00007fadfa013f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fadfa1e6128 R14: 00007fadfa1e6090 R15: 00007ffc8b166bd8
 </TASK>

Allocated by task 4478:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6b/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3359 [inline]
 slab_alloc mm/slub.c:3367 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3374 [inline]
 kmem_cache_alloc+0x123/0x2f0 mm/slub.c:3383
 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2786 [inline]
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2796 [inline]
 __grab_extent_tree+0x19b/0x3d0 fs/f2fs/extent_cache.c:384
 f2fs_init_read_extent_tree+0x29e/0x7c0 fs/f2fs/extent_cache.c:455
 do_read_inode fs/f2fs/inode.c:459 [inline]
 f2fs_iget+0x36e1/0x4b30 fs/f2fs/inode.c:512
 f2fs_nfs_get_inode+0x72/0x100 fs/f2fs/super.c:3157
 generic_fh_to_dentry+0x8f/0xe0 fs/libfs.c:1072
 exportfs_decode_fh_raw+0x12a/0x640 fs/exportfs/expfs.c:435
 exportfs_decode_fh+0x36/0x70 fs/exportfs/expfs.c:575
 do_handle_to_path fs/fhandle.c:152 [inline]
 handle_to_path fs/fhandle.c:207 [inline]
 do_handle_open+0x3df/0x810 fs/fhandle.c:223
 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 4478:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1729 [inline]
 slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1755
 slab_free mm/slub.c:3687 [inline]
 kmem_cache_free+0xf7/0x290 mm/slub.c:3709
 __destroy_extent_tree fs/f2fs/extent_cache.c:1011 [inline]
 f2fs_destroy_extent_tree+0x2c3/0x5f0 fs/f2fs/extent_cache.c:1022
 f2fs_evict_inode+0x460/0x17d0 fs/f2fs/inode.c:781
 evict+0x485/0x870 fs/inode.c:705
 f2fs_iget+0x1888/0x4b30 fs/f2fs/inode.c:565
 f2fs_nfs_get_inode+0x72/0x100 fs/f2fs/super.c:3157
 generic_fh_to_dentry+0x8f/0xe0 fs/libfs.c:1072
 exportfs_decode_fh_raw+0x12a/0x640 fs/exportfs/expfs.c:435
 exportfs_decode_fh+0x36/0x70 fs/exportfs/expfs.c:575
 do_handle_to_path fs/fhandle.c:152 [inline]
 handle_to_path fs/fhandle.c:207 [inline]
 do_handle_open+0x3df/0x810 fs/fhandle.c:223
 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

The buggy address belongs to the object at ffff888071af8898
 which belongs to the cache f2fs_extent_tree of size 136
The buggy address is located 128 bytes inside of
 136-byte region [ffff888071af8898, ffff888071af8920)

The buggy address belongs to the physical page:
page:ffffea0001c6be00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x71af8
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff88801c388dc0
raw: 0000000000000000 0000000080140014 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x112c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 4429, tgid 4428 (syz.0.18), ts 88480907869, free_ts 88035016037
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614
 alloc_slab_page+0x5d/0x160 mm/slub.c:1799
 allocate_slab mm/slub.c:1944 [inline]
 new_slab+0x87/0x2c0 mm/slub.c:1997
 ___slab_alloc+0xbc6/0x1230 mm/slub.c:3154
 __slab_alloc mm/slub.c:3240 [inline]
 slab_alloc_node mm/slub.c:3325 [inline]
 slab_alloc mm/slub.c:3367 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3374 [inline]
 kmem_cache_alloc+0x1b7/0x2f0 mm/slub.c:3383
 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2786 [inline]
 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2796 [inline]
 __grab_extent_tree+0x19b/0x3d0 fs/f2fs/extent_cache.c:384
 f2fs_init_read_extent_tree+0x29e/0x7c0 fs/f2fs/extent_cache.c:455
 do_read_inode fs/f2fs/inode.c:459 [inline]
 f2fs_iget+0x36e1/0x4b30 fs/f2fs/inode.c:512
 f2fs_nfs_get_inode+0x72/0x100 fs/f2fs/super.c:3157
 generic_fh_to_dentry+0x8f/0xe0 fs/libfs.c:1072
 exportfs_decode_fh_raw+0x12a/0x640 fs/exportfs/expfs.c:435
 exportfs_decode_fh+0x36/0x70 fs/exportfs/expfs.c:575
 do_handle_to_path fs/fhandle.c:152 [inline]
 handle_to_path fs/fhandle.c:207 [inline]
 do_handle_open+0x3df/0x810 fs/fhandle.c:223
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479
 free_slab mm/slub.c:2036 [inline]
 discard_slab mm/slub.c:2042 [inline]
 __unfreeze_partials+0x1a5/0x200 mm/slub.c:2591
 put_cpu_partial+0x17c/0x250 mm/slub.c:2667
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3359 [inline]
 slab_alloc mm/slub.c:3367 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3374 [inline]
 kmem_cache_alloc+0x123/0x2f0 mm/slub.c:3383
 getname_flags+0xb7/0x500 fs/namei.c:139
 do_sys_openat2+0xcf/0x490 fs/open.c:1314
 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:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff888071af8800: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
 ffff888071af8880: fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888071af8900: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
                            ^
 ffff888071af8980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888071af8a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/12/29 09:13 linux-6.1.y 50cbba13faa2 d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-1-kasan KASAN: use-after-free Read in sanity_check_extent_cache
2025/04/19 23:20 linux-6.1.y 420102835862 2a20f901 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in sanity_check_extent_cache
2025/03/28 08:09 linux-6.1.y 344a09659766 6c09fb82 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in sanity_check_extent_cache
2025/12/29 07:52 linux-6.1.y 50cbba13faa2 d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in sanity_check_extent_cache
* Struck through repros no longer work on HEAD.