syzbot


KASAN: use-after-free Write in ext4_insert_dentry

Status: upstream: reported C repro on 2024/10/27 00:37
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+4f97858f927585131c64@syzkaller.appspotmail.com
First crash: 38d, last: 9d08h
Bug presence (2)
Date Name Commit Repro Result
2024/10/27 lts (merge base) 3a5928702e71 C [report] KASAN: use-after-free Write in ext4_insert_dentry
2024/10/27 upstream (ToT) 850925a8133c C [report] KASAN: use-after-free Write in ext4_insert_dentry
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Write in ext4_insert_dentry origin:upstream C 3 3d20h 3d21h 0/2 upstream: reported C repro on 2024/11/30 15:43
android-5-10 KASAN: use-after-free Write in ext4_insert_dentry C 11 7d10h 81d 0/2 upstream: reported C repro on 2024/09/14 11:48
linux-5.15 KASAN: use-after-free Write in ext4_insert_dentry origin:upstream C 4 4d12h 4d15h 0/3 upstream: reported C repro on 2024/11/29 21:09
upstream KASAN: use-after-free Write in ext4_insert_dentry ext4 C done 52 12h36m 39d 0/28 upstream: reported C repro on 2024/10/25 22:56
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/11/18 06:53 6m retest repro android13-5.15-lts report log
2024/11/18 06:53 5m retest repro android13-5.15-lts report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_insert_dentry+0x392/0x710 fs/ext4/namei.c:2153
Write of size 251 at addr ffff88810e187f14 by task syz-executor184/289

CPU: 1 PID: 289 Comm: syz-executor184 Not tainted 5.15.167-syzkaller-android13-5.15.167_r00 #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
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 memcpy+0x44/0x70 mm/kasan/shadow.c:66
 ext4_insert_dentry+0x392/0x710 fs/ext4/namei.c:2153
 add_dirent_to_buf+0x384/0x7d0 fs/ext4/namei.c:2198
 make_indexed_dir+0xf34/0x15a0 fs/ext4/namei.c:2396
 ext4_add_entry+0xde2/0x12b0 fs/ext4/namei.c:2502
 ext4_add_nondir+0x97/0x290 fs/ext4/namei.c:2843
 ext4_symlink+0x913/0xed0 fs/ext4/namei.c:3496
 vfs_symlink+0x29f/0x480 fs/namei.c:4429
 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4458
 __do_sys_symlink fs/namei.c:4480 [inline]
 __se_sys_symlink fs/namei.c:4478 [inline]
 __x64_sys_symlink+0x7e/0x90 fs/namei.c:4478
 x64_sys_call+0x290/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:89
 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:0x7ffae7523b99
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff534813f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007ffae7523b99
RDX: 0000000000000000 RSI: 0000000020000cc0 RDI: 0000000020000dc0
RBP: 00007ffae75975f0 R08: 000055556e1ed4c0 R09: 000055556e1ed4c0
R10: 000055556e1ed4c0 R11: 0000000000000246 R12: 00007fff53481420
R13: 00007fff53481648 R14: 431bde82d7b634db R15: 00007ffae756c03b
 </TASK>

The buggy address belongs to the page:
page:ffffea00043861c0 refcount:3 mapcount:0 mapping:ffff8881092cfa18 index:0x3f pfn:0x10e187
memcg:ffff888100214000
aops:def_blk_aops ino:700000
flags: 0x400000000000202a(referenced|dirty|active|private|zone=1)
raw: 400000000000202a 0000000000000000 dead000000000122 ffff8881092cfa18
raw: 000000000000003f ffff8881004ccd20 00000003ffffffff ffff888100214000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x108c48(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE), pid 289, ts 21361588977, free_ts 15675619464
 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]
 __page_cache_alloc include/linux/pagemap.h:305 [inline]
 pagecache_get_page+0xb18/0xeb0 mm/filemap.c:1946
 find_or_create_page include/linux/pagemap.h:418 [inline]
 grow_dev_page fs/buffer.c:949 [inline]
 grow_buffers fs/buffer.c:1014 [inline]
 __getblk_slow fs/buffer.c:1041 [inline]
 __getblk_gfp+0x21e/0x7c0 fs/buffer.c:1336
 sb_getblk include/linux/buffer_head.h:361 [inline]
 ext4_getblk+0x259/0x700 fs/ext4/inode.c:877
 ext4_bread+0x2f/0x180 fs/ext4/inode.c:923
 ext4_append+0x31f/0x5b0 fs/ext4/namei.c:83
 make_indexed_dir+0x515/0x15a0 fs/ext4/namei.c:2316
 ext4_add_entry+0xde2/0x12b0 fs/ext4/namei.c:2502
 ext4_add_nondir+0x97/0x290 fs/ext4/namei.c:2843
 ext4_symlink+0x913/0xed0 fs/ext4/namei.c:3496
 vfs_symlink+0x29f/0x480 fs/namei.c:4429
 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4458
 __do_sys_symlink fs/namei.c:4480 [inline]
 __se_sys_symlink fs/namei.c:4478 [inline]
 __x64_sys_symlink+0x7e/0x90 fs/namei.c:4478
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_list+0x14b/0xa60 mm/page_alloc.c:3671
 release_pages+0x1310/0x1370 mm/swap.c:1009
 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:320
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
 exit_mmap+0x40d/0x940 mm/mmap.c:3218
 __mmput+0x95/0x310 kernel/fork.c:1179
 mmput+0x5b/0x170 kernel/fork.c:1202
 exit_mm kernel/exit.c:554 [inline]
 do_exit+0xb9c/0x2ca0 kernel/exit.c:867
 do_group_exit+0x141/0x310 kernel/exit.c:1002
 __do_sys_exit_group kernel/exit.c:1013 [inline]
 __se_sys_exit_group kernel/exit.c:1011 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1011
 x64_sys_call+0x610/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:232
 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:
 ffff88810e187f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88810e187f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88810e188000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88810e188080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88810e188100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/27 00:53 android13-5.15-lts 5e4635681cf1 65e8686b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
2024/10/27 00:33 android13-5.15-lts 5e4635681cf1 65e8686b .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
2024/11/25 04:01 android13-5.15-lts 101e665d55a8 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
2024/11/24 22:27 android13-5.15-lts 101e665d55a8 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
2024/11/04 04:24 android13-5.15-lts 5e4635681cf1 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
2024/10/27 22:24 android13-5.15-lts 5e4635681cf1 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
2024/10/27 00:07 android13-5.15-lts 5e4635681cf1 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in ext4_insert_dentry
* Struck through repros no longer work on HEAD.