[Android 6.1] KASAN: use-after-free Read in sanity_check_extent_cache

0 views
Skip to first unread message

syzbot

unread,
Jun 17, 2025, 7:46:29 PMJun 17
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ba4506940166 Revert "ANDROID: mm: Set PAGE_BLOCK_ORDER to ..
git tree: android14-6.1
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15b0de82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2b16d7d556e93651
dashboard link: https://syzkaller.appspot.com/bug?extid=92290a02305440f45ddf
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=165ad5d4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14ccf90c580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/bc8b8d0b7192/disk-ba450694.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/cc6c52359f65/vmlinux-ba450694.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6a327bf5c733/bzImage-ba450694.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/4d8de466c04e/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=11b0de82580000)

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

==================================================================
BUG: KASAN: use-after-free in sanity_check_extent_cache+0x3cc/0x480 fs/f2fs/extent_cache.c:47
Read of size 4 at addr ffff888125090c78 by task syz-executor412/366

CPU: 0 PID: 366 Comm: syz-executor412 Not tainted 6.1.138-syzkaller-00010-gba4506940166 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
__dump_stack+0x21/0x24 lib/dump_stack.c:88
dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
print_address_description+0x71/0x210 mm/kasan/report.c:316
print_report+0x4a/0x60 mm/kasan/report.c:427
kasan_report+0x122/0x150 mm/kasan/report.c:531
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350
sanity_check_extent_cache+0x3cc/0x480 fs/f2fs/extent_cache.c:47
do_read_inode fs/f2fs/inode.c:457 [inline]
f2fs_iget+0x3312/0x4cb0 fs/f2fs/inode.c:508
f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:484
lookup_open fs/namei.c:3459 [inline]
open_last_lookups fs/namei.c:3549 [inline]
path_openat+0xff3/0x2f50 fs/namei.c:3779
do_filp_open+0x1c1/0x3c0 fs/namei.c:3809
do_sys_openat2+0x185/0x7e0 fs/open.c:1341
do_sys_open fs/open.c:1357 [inline]
__do_sys_openat fs/open.c:1373 [inline]
__se_sys_openat fs/open.c:1368 [inline]
__x64_sys_openat+0x136/0x160 fs/open.c:1368
x64_sys_call+0x783/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258
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:0x7fced31b6b89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 18 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fced3152218 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fced324f6b8 RCX: 00007fced31b6b89
RDX: 0000000000101000 RSI: 0000200000000080 RDI: 00000000ffffff9c
RBP: 00007fced324f6b0 R08: 00007ffdf8b39217 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000246 R12: 0000200000000080
R13: 0000200000000280 R14: 0032656c69662f2e R15: 0033656c69662f2e
</TASK>

Allocated by task 337:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505
__kasan_slab_alloc+0x72/0x80 mm/kasan/common.c:333
kasan_slab_alloc include/linux/kasan.h:202 [inline]
slab_post_alloc_hook+0x4f/0x2d0 mm/slab.h:768
slab_alloc_node mm/slub.c:3421 [inline]
slab_alloc mm/slub.c:3431 [inline]
__kmem_cache_alloc_lru mm/slub.c:3438 [inline]
kmem_cache_alloc+0x16e/0x330 mm/slub.c:3447
f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:-1 [inline]
__grab_extent_tree+0x19d/0x430 fs/f2fs/extent_cache.c:335
f2fs_init_read_extent_tree+0x3d4/0x7e0 fs/f2fs/extent_cache.c:406
do_read_inode fs/f2fs/inode.c:454 [inline]
f2fs_iget+0x3302/0x4cb0 fs/f2fs/inode.c:508
f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:484
__lookup_slow+0x2c7/0x3f0 fs/namei.c:1689
lookup_slow+0x57/0x70 fs/namei.c:1706
walk_component+0x2f4/0x420 fs/namei.c:1997
lookup_last fs/namei.c:2454 [inline]
path_lookupat+0x180/0x490 fs/namei.c:2478
filename_lookup+0x1f0/0x500 fs/namei.c:2507
user_path_at_empty+0x47/0x1c0 fs/namei.c:2904
user_path_at include/linux/namei.h:57 [inline]
do_sys_truncate+0xa3/0x190 fs/open.c:133
__do_sys_truncate fs/open.c:147 [inline]
__se_sys_truncate fs/open.c:145 [inline]
__x64_sys_truncate+0x5b/0x70 fs/open.c:145
x64_sys_call+0x679/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:77
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 337:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x31/0x50 mm/kasan/generic.c:516
____kasan_slab_free+0x132/0x180 mm/kasan/common.c:241
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
kasan_slab_free include/linux/kasan.h:178 [inline]
slab_free_hook mm/slub.c:1745 [inline]
slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1771
slab_free mm/slub.c:3686 [inline]
kmem_cache_free+0x12d/0x300 mm/slub.c:3711
__destroy_extent_tree+0x305/0x500 fs/f2fs/extent_cache.c:1135
f2fs_destroy_extent_tree+0x17/0x30 fs/f2fs/extent_cache.c:1146
f2fs_evict_inode+0x4eb/0x14f0 fs/f2fs/inode.c:778
evict+0x493/0x890 fs/inode.c:705
iput_final fs/inode.c:1834 [inline]
iput+0x620/0x670 fs/inode.c:1860
iget_failed+0x17a/0x1c0 fs/bad_inode.c:250
f2fs_iget+0x218c/0x4cb0 fs/f2fs/inode.c:561
f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:484
__lookup_slow+0x2c7/0x3f0 fs/namei.c:1689
lookup_slow+0x57/0x70 fs/namei.c:1706
walk_component+0x2f4/0x420 fs/namei.c:1997
lookup_last fs/namei.c:2454 [inline]
path_lookupat+0x180/0x490 fs/namei.c:2478
filename_lookup+0x1f0/0x500 fs/namei.c:2507
user_path_at_empty+0x47/0x1c0 fs/namei.c:2904
user_path_at include/linux/namei.h:57 [inline]
do_sys_truncate+0xa3/0x190 fs/open.c:133
__do_sys_truncate fs/open.c:147 [inline]
__se_sys_truncate fs/open.c:145 [inline]
__x64_sys_truncate+0x5b/0x70 fs/open.c:145
x64_sys_call+0x679/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:77
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 ffff888125090c30
which belongs to the cache f2fs_extent_tree of size 88
The buggy address is located 72 bytes inside of
88-byte region [ffff888125090c30, ffff888125090c88)

The buggy address belongs to the physical page:
page:ffffea0004942400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x125090
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 dead000000000122 ffff88810ad53e00
raw: 0000000000000000 0000000080220022 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 0x12c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_RECLAIMABLE), pid 303, tgid 300 (syz-executor412), ts 29723519477, free_ts 0
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2637
prep_new_page+0x1c/0x110 mm/page_alloc.c:2644
get_page_from_freelist+0x2c7b/0x2cf0 mm/page_alloc.c:4539
__alloc_pages+0x19e/0x3a0 mm/page_alloc.c:5842
alloc_slab_page+0x6e/0xf0 include/linux/gfp.h:-1
allocate_slab mm/slub.c:1962 [inline]
new_slab+0x98/0x3d0 mm/slub.c:2015
___slab_alloc+0x6f6/0xb50 mm/slub.c:3203
__slab_alloc+0x5e/0xa0 mm/slub.c:3302
slab_alloc_node mm/slub.c:3387 [inline]
slab_alloc mm/slub.c:3431 [inline]
__kmem_cache_alloc_lru mm/slub.c:3438 [inline]
kmem_cache_alloc+0x1b0/0x330 mm/slub.c:3447
f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:-1 [inline]
__grab_extent_tree+0x19d/0x430 fs/f2fs/extent_cache.c:335
f2fs_init_read_extent_tree+0x3d4/0x7e0 fs/f2fs/extent_cache.c:406
do_read_inode fs/f2fs/inode.c:454 [inline]
f2fs_iget+0x3302/0x4cb0 fs/f2fs/inode.c:508
f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:484
__lookup_slow+0x2c7/0x3f0 fs/namei.c:1689
lookup_slow+0x57/0x70 fs/namei.c:1706
walk_component+0x2f4/0x420 fs/namei.c:1997
page_owner free stack trace missing

Memory state around the buggy address:
ffff888125090b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888125090b80: fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb
>ffff888125090c00: fb fb fc fc fc fc fa fb fb fb fb fb fb fb fb fb
^
ffff888125090c80: fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888125090d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
F2FS-fs (loop4): sanity_check_extent_cache: inode (ino=8) extent info [14338, 0, 2147549187] is incorrect, run fsck to fix


---
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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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