syzbot


KASAN: use-after-free Read in ext4_htree_fill_tree

Status: upstream: reported C repro on 2024/12/27 19:48
Reported-by: syzbot+254e41833ea7ee21fe91@syzkaller.appspotmail.com
First crash: 1d04h, last: 23h13m
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in ext4_htree_fill_tree C 4 6d01h 6d05h 0/2 upstream: reported C repro on 2024/12/22 19:07
linux-6.1 KASAN: use-after-free Read in ext4_htree_fill_tree 1 106d 106d 0/3 auto-obsoleted due to no activity on 2024/12/22 07:44
android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree C 12 10d 160d 0/2 upstream: reported C repro on 2024/07/21 20:19

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_htree_fill_tree+0x131b/0x13e0 fs/ext4/namei.c:1246
Read of size 1 at addr ffff88811a671a67 by task syz-executor343/297

CPU: 1 PID: 297 Comm: syz-executor343 Not tainted 5.15.173-syzkaller-00161-gb4bd207b0380 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
 ext4_htree_fill_tree+0x131b/0x13e0 fs/ext4/namei.c:1246
 ext4_dx_readdir fs/ext4/dir.c:606 [inline]
 ext4_readdir+0x2f75/0x3960 fs/ext4/dir.c:142
 iterate_dir+0x265/0x600
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x1c1/0x460 fs/readdir.c:354
 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354
 x64_sys_call+0x5ae/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:218
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fb104dfd573
Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 52 47 fb ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8
RSP: 002b:00007ffc8efce7e8 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 000055558191e730 RCX: 00007fb104dfd573
RDX: 0000000000008000 RSI: 000055558191e730 RDI: 0000000000000004
RBP: 000055558191e704 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb8
R13: 0000000000000010 R14: 000055558191e700 R15: 00007ffc8efd0a60
 </TASK>

The buggy address belongs to the page:
page:ffffea0004699c40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a671
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea0004699c88 ffffea0004699c08 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), pid 279, ts 20828983642, free_ts 20829081258
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485
 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779
 __alloc_pages_node include/linux/gfp.h:591 [inline]
 alloc_pages_node include/linux/gfp.h:605 [inline]
 alloc_pages include/linux/gfp.h:618 [inline]
 pipe_write+0x551/0x1930 fs/pipe.c:500
 call_write_iter include/linux/fs.h:2206 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xd5d/0x1110 fs/read_write.c:594
 ksys_write+0x199/0x2c0 fs/read_write.c:647
 __do_sys_write fs/read_write.c:659 [inline]
 __se_sys_write fs/read_write.c:656 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:656
 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1472 [inline]
 free_pcp_prepare mm/page_alloc.c:1544 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534
 free_unref_page+0xe8/0x750 mm/page_alloc.c:3616
 __put_single_page mm/swap.c:98 [inline]
 __put_page+0xb0/0xe0 mm/swap.c:129
 put_page include/linux/mm.h:1295 [inline]
 anon_pipe_buf_release+0x187/0x200 fs/pipe.c:137
 pipe_buf_release include/linux/pipe_fs_i.h:219 [inline]
 pipe_read+0x5a6/0x1040 fs/pipe.c:323
 call_read_iter include/linux/fs.h:2200 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa81/0xd40 fs/read_write.c:485
 ksys_read+0x199/0x2c0 fs/read_write.c:623
 __do_sys_read fs/read_write.c:633 [inline]
 __se_sys_read fs/read_write.c:631 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:631
 x64_sys_call+0x28/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88811a671900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811a671980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811a671a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                       ^
 ffff88811a671a80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811a671b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/27 23:11 android13-5.15-lts b4bd207b0380 d3ccff63 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_htree_fill_tree
2024/12/27 21:13 android13-5.15-lts b4bd207b0380 d3ccff63 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_htree_fill_tree
2024/12/27 19:46 android13-5.15-lts b4bd207b0380 d3ccff63 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_htree_fill_tree
2024/12/28 01:22 android13-5.15-lts b4bd207b0380 d3ccff63 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_htree_fill_tree
* Struck through repros no longer work on HEAD.