syzbot


KASAN: use-after-free Write in ext4_insert_dentry

Status: upstream: reported C repro on 2024/11/29 21:09
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+0472540567477a66423c@syzkaller.appspotmail.com
First crash: 21d, last: 7d05h
Bug presence (1)
Date Name Commit Repro Result
2024/11/30 upstream (ToT) 2ba9f676d0a2 C [report] KASAN: slab-use-after-free Write in ext4_insert_dentry
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Write in ext4_insert_dentry origin:upstream C 8 3d01h 55d 0/2 upstream: reported C repro on 2024/10/27 00:37
android-6-1 KASAN: use-after-free Write in ext4_insert_dentry origin:upstream C 4 11d 21d 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 10d 98d 0/2 upstream: reported C repro on 2024/09/14 11:48
upstream KASAN: use-after-free Write in ext4_insert_dentry ext4 C done 64 23h57m 56d 0/28 upstream: reported C repro on 2024/10/25 22:56
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/12/14 10:11 12m retest repro linux-5.15.y report log
2024/12/14 10:11 10m retest repro linux-5.15.y report log
2024/12/14 10:11 14m retest repro linux-5.15.y report log

Sample crash report:
EXT4-fs error (device loop0): ext4_xattr_inode_iget:409: comm syz-executor317: error while reading EA inode 1 err=-117
EXT4-fs (loop0): 1 orphan inode deleted
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue. Quota mode: none.
==================================================================
BUG: KASAN: use-after-free in ext4_insert_dentry+0x366/0x6c0 fs/ext4/namei.c:2155
Write of size 250 at addr ffff88800f458f18 by task syz-executor317/4165

CPU: 0 PID: 4165 Comm: syz-executor317 Not tainted 5.15.173-syzkaller #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+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 memcpy+0x3c/0x60 mm/kasan/shadow.c:66
 ext4_insert_dentry+0x366/0x6c0 fs/ext4/namei.c:2155
 add_dirent_to_buf+0x384/0x7d0 fs/ext4/namei.c:2200
 make_indexed_dir+0xf34/0x15a0 fs/ext4/namei.c:2398
 ext4_add_entry+0xde2/0x12b0 fs/ext4/namei.c:2504
 ext4_mkdir+0x54f/0xce0 fs/ext4/namei.c:3081
 vfs_mkdir+0x3b6/0x590 fs/namei.c:4065
 do_mkdirat+0x260/0x520 fs/namei.c:4090
 __do_sys_mkdirat fs/namei.c:4105 [inline]
 __se_sys_mkdirat fs/namei.c:4103 [inline]
 __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4103
 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:0x7fd4a09aa4c9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 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:00007ffe9a8a0f48 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fd4a09aa4c9
RDX: 5be60480b9579340 RSI: 0000000020000940 RDI: 00000000ffffff9c
RBP: 00007fd4a09f5187 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd4a09f510c
R13: 00007ffe9a8a0f70 R14: 00007fd4a09fafdc R15: 00007fd4a09f504b
 </TASK>

The buggy address belongs to the page:
page:ffffea00003d1600 refcount:3 mapcount:0 mapping:ffff88801dbb5af0 index:0x3f pfn:0xf458
memcg:ffff888018154000
aops:def_blk_aops ino:700000
flags: 0xfff0000000202a(referenced|dirty|active|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff0000000202a 0000000000000000 dead000000000122 ffff88801dbb5af0
raw: 000000000000003f ffff888073c40658 00000003ffffffff ffff888018154000
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 4165, ts 59732229357, free_ts 53951548932
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5464
 __page_cache_alloc+0xd4/0x4a0 mm/filemap.c:1022
 pagecache_get_page+0xa91/0x1010 mm/filemap.c:1940
 find_or_create_page include/linux/pagemap.h:420 [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+0x22a/0xaf0 fs/buffer.c:1336
 sb_getblk include/linux/buffer_head.h:361 [inline]
 ext4_getblk+0x259/0x710 fs/ext4/inode.c:876
 ext4_bread+0x2a/0x170 fs/ext4/inode.c:922
 ext4_append+0x31f/0x5c0 fs/ext4/namei.c:83
 make_indexed_dir+0x515/0x15a0 fs/ext4/namei.c:2318
 ext4_add_entry+0xde2/0x12b0 fs/ext4/namei.c:2504
 ext4_mkdir+0x54f/0xce0 fs/ext4/namei.c:3081
 vfs_mkdir+0x3b6/0x590 fs/namei.c:4065
 do_mkdirat+0x260/0x520 fs/namei.c:4090
 __do_sys_mkdirat fs/namei.c:4105 [inline]
 __se_sys_mkdirat fs/namei.c:4103 [inline]
 __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4103
 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:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 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
 unmap_region+0x304/0x350 mm/mmap.c:2668
 __do_munmap+0x12db/0x1740 mm/mmap.c:2899
 __vm_munmap+0x134/0x230 mm/mmap.c:2922
 __do_sys_munmap mm/mmap.c:2948 [inline]
 __se_sys_munmap mm/mmap.c:2944 [inline]
 __x64_sys_munmap+0x67/0x70 mm/mmap.c:2944
 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:
 ffff88800f458f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88800f458f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88800f459000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88800f459080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88800f459100: 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/11/30 00:32 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Write in ext4_insert_dentry
2024/11/29 23:20 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Write in ext4_insert_dentry
2024/11/29 22:15 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Write in ext4_insert_dentry
2024/11/29 21:08 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in ext4_insert_dentry
* Struck through repros no longer work on HEAD.