syzbot


KASAN: use-after-free Read in ext4_convert_inline_data_nolock

Status: upstream: reported C repro on 2024/04/30 09:11
Reported-by: syzbot+bb996ea82568b0593462@syzkaller.appspotmail.com
First crash: 54d, last: 40d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 1 28d 399d 0/3 upstream: reported C repro on 2023/05/21 13:36
upstream KASAN: slab-use-after-free Read in ext4_convert_inline_data_nolock ext4 C error done 7 177d 454d 26/27 fixed on 2024/02/03 12:44
android-5-10 KASAN: use-after-free Read in ext4_convert_inline_data_nolock syz 1 22d 54d 0/2 premoderation: reported syz repro on 2024/04/30 09:18
android-6-1 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 1 10d 54d 0/2 upstream: reported C repro on 2024/04/30 15:29
android-5-15 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 1 11d 25d 0/2 upstream: reported C repro on 2024/05/29 02:55
linux-6.1 KASAN: use-after-free Read in ext4_convert_inline_data_nolock origin:upstream C 2 26d 435d 0/3 upstream: reported C repro on 2023/04/15 09:27
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/05/14 10:04 6m retest repro android12-5.4 report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_read_inline_data fs/ext4/inline.c:209 [inline]
BUG: KASAN: use-after-free in ext4_convert_inline_data_nolock+0x319/0xd80 fs/ext4/inline.c:1224
Read of size 68 at addr ffff8881dcf4b0cf by task syz-executor794/363

CPU: 0 PID: 363 Comm: syz-executor794 Not tainted 5.4.268-syzkaller-00003-g2d5d8240a7cb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 print_address_description+0x8c/0x600 mm/kasan/report.c:384
 __kasan_report+0xf3/0x120 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x272/0x280 mm/kasan/generic.c:191
 memcpy+0x25/0x50 mm/kasan/common.c:123
 ext4_read_inline_data fs/ext4/inline.c:209 [inline]
 ext4_convert_inline_data_nolock+0x319/0xd80 fs/ext4/inline.c:1224
 ext4_try_add_inline_entry+0x7ff/0xb20 fs/ext4/inline.c:1349
 ext4_add_entry+0x6c2/0x1240 fs/ext4/namei.c:2352
 ext4_mkdir+0xc9f/0x1520 fs/ext4/namei.c:2942
 vfs_mkdir+0x41f/0x600 fs/namei.c:3916
 do_mkdirat+0x1a9/0x2c0 fs/namei.c:3939
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

The buggy address belongs to the page:
page:ffffea000773d2c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1
flags: 0x8000000000000000()
raw: 8000000000000000 ffffea000773d308 ffffea000773f508 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x100cca(GFP_HIGHUSER_MOVABLE)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
 get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
 __alloc_pages include/linux/gfp.h:503 [inline]
 __alloc_pages_node include/linux/gfp.h:516 [inline]
 alloc_pages_node include/linux/gfp.h:530 [inline]
 shmem_alloc_page mm/shmem.c:1503 [inline]
 shmem_alloc_and_acct_page+0x492/0x9d0 mm/shmem.c:1528
 shmem_getpage_gfp+0xf5d/0x2440 mm/shmem.c:1852
 shmem_getpage mm/shmem.c:154 [inline]
 shmem_write_begin+0xc9/0x1a0 mm/shmem.c:2447
 generic_perform_write+0x2c7/0x560 mm/filemap.c:3450
 __generic_file_write_iter+0x224/0x530 mm/filemap.c:3579
 generic_file_write_iter+0x455/0x5f0 mm/filemap.c:3611
 call_write_iter include/linux/fs.h:1983 [inline]
 new_sync_write fs/read_write.c:483 [inline]
 __vfs_write+0x5d3/0x750 fs/read_write.c:496
 vfs_write+0x206/0x4e0 fs/read_write.c:558
 ksys_write+0x199/0x2c0 fs/read_write.c:611
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 free_pcp_prepare mm/page_alloc.c:1233 [inline]
 free_unref_page_prepare+0x297/0x380 mm/page_alloc.c:3085
 free_unref_page_list+0x10a/0x590 mm/page_alloc.c:3154
 release_pages+0xad8/0xb20 mm/swap.c:842
 __pagevec_release+0xc3/0x150 mm/swap.c:862
 pagevec_release include/linux/pagevec.h:88 [inline]
 shmem_undo_range+0x8a5/0x1ad0 mm/shmem.c:875
 shmem_truncate_range mm/shmem.c:997 [inline]
 shmem_evict_inode+0x218/0x9a0 mm/shmem.c:1097
 evict+0x29b/0x6a0 fs/inode.c:575
 __dentry_kill+0x429/0x630 fs/dcache.c:579
 dentry_kill+0xb8/0x280 fs/dcache.c:673
 dput+0x154/0x2f0 fs/dcache.c:859
 __fput+0x443/0x680 fs/file_table.c:294
 task_work_run+0x140/0x170 kernel/task_work.c:113
 ptrace_notify+0x29e/0x350 kernel/signal.c:2271
 ptrace_report_syscall include/linux/tracehook.h:66 [inline]
 tracehook_report_syscall_exit include/linux/tracehook.h:129 [inline]
 syscall_slow_exit_work+0x167/0x400 arch/x86/entry/common.c:246
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x19d/0x1c0 arch/x86/entry/common.c:300
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Memory state around the buggy address:
 ffff8881dcf4af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881dcf4b000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881dcf4b080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              ^
 ffff8881dcf4b100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881dcf4b180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs error (device loop1): ext4_check_all_de:657: inode #12: block 5: comm syz-executor794: bad entry in directory: rec_len is smaller than minimal - offset=0, inode=0, rec_len=0, size=124 fake=0

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/30 09:10 android12-5.4 2d5d8240a7cb f10afd69 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-android-5-4-kasan KASAN: use-after-free Read in ext4_convert_inline_data_nolock
* Struck through repros no longer work on HEAD.