KASAN: use-after-free Write in __ext4_expand_extra_isize

Status: auto-closed as invalid on 2020/03/10 14:13
First crash: 1067d, last: 956d
similar bugs (4):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in __ext4_expand_extra_isize C 95 1152d 1544d 13/22 fixed on 2019/06/14 18:22
linux-4.19 KASAN: use-after-free Write in __ext4_expand_extra_isize 7 944d 1005d 0/1 auto-closed as invalid on 2020/03/22 21:28
upstream KASAN: use-after-free Write in __ext4_expand_extra_isize (2) 14 960d 977d 16/22 fixed on 2019/12/13 00:31
android-414 KASAN: use-after-free Write in __ext4_expand_extra_isize 65 935d 1168d 0/1 auto-closed as invalid on 2020/03/31 02:59

Sample crash report:
BUG: KASAN: use-after-free in memset include/linux/string.h:332 [inline]
BUG: KASAN: use-after-free in __ext4_expand_extra_isize+0x14f/0x220 fs/ext4/inode.c:5763
Write of size 736 at addr ffff88820ffc2ea0 by task syz-executor.4/22679

CPU: 0 PID: 22679 Comm: syz-executor.4 Not tainted 4.14.152 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memset+0x24/0x40 mm/kasan/kasan.c:285
 memset include/linux/string.h:332 [inline]
 __ext4_expand_extra_isize+0x14f/0x220 fs/ext4/inode.c:5763
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5815 [inline]
 ext4_mark_inode_dirty+0x664/0x860 fs/ext4/inode.c:5891
 ext4_ext_truncate+0x96/0x1f0 fs/ext4/extents.c:4653
 ext4_truncate+0xbab/0x11f0 fs/ext4/inode.c:4432
 ext4_evict_inode+0x8be/0x15c0 fs/ext4/inode.c:288
 evict+0x2e6/0x630 fs/inode.c:554
 iput_final fs/inode.c:1516 [inline]
 iput fs/inode.c:1543 [inline]
 iput+0x471/0x900 fs/inode.c:1528
 dentry_unlink_inode+0x286/0x340 fs/dcache.c:387
 __dentry_kill+0x32e/0x580 fs/dcache.c:591
 dentry_kill fs/dcache.c:632 [inline]
 dput.part.0+0x4e3/0x750 fs/dcache.c:847
 dput+0x20/0x30 fs/dcache.c:811
 path_put+0x31/0x70 fs/namei.c:501
 free_fs_struct+0x25/0x70 fs/fs_struct.c:90
 exit_fs+0xe7/0x120 fs/fs_struct.c:107
 do_exit+0x7b9/0x2c10 kernel/exit.c:870
 do_group_exit+0x111/0x330 kernel/exit.c:977
 get_signal+0x381/0x1cd0 kernel/signal.c:2409
 do_signal+0x86/0x19a0 arch/x86/kernel/signal.c:814
 exit_to_usermode_loop+0x15c/0x220 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
RIP: 0033:0x45a219
RSP: 002b:00007fb31179bcf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000075c1c8 RCX: 000000000045a219
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000075c1c8
RBP: 000000000075c1c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000075c1cc
R13: 00007fff6de4c50f R14: 00007fb31179c9c0 R15: 000000000075c1cc

The buggy address belongs to the page:
page:ffffea00083ff080 count:2 mapcount:0 mapping:ffff88821844b520 index:0x46a
flags: 0x6fffc0000001074(referenced|dirty|lru|active|private)
raw: 06fffc0000001074 ffff88821844b520 000000000000046a 00000002ffffffff
raw: ffffea000838a460 ffffea000847f3a0 ffff88807a7f42a0 ffff88821b7321c0
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88820ffc2f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88820ffc2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88820ffc3000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88820ffc3080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88820ffc3100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Crashes (11):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2019/11/11 14:12 linux-4.14.y c9fda4f22428 dc438b91 .config log report
ci2-linux-4-14 2019/10/19 15:26 linux-4.14.y b98aebd29824 8c88c9c1 .config log report
ci2-linux-4-14 2019/10/18 04:38 linux-4.14.y b98aebd29824 8c88c9c1 .config log report
ci2-linux-4-14 2019/10/14 03:27 linux-4.14.y e132c8d7b58d 2f661ec4 .config log report
ci2-linux-4-14 2019/10/04 22:52 linux-4.14.y f6e27dbb1afa c86336cf .config log report
ci2-linux-4-14 2019/10/02 09:09 linux-4.14.y f6e27dbb1afa b7a87a83 .config log report
ci2-linux-4-14 2019/09/30 04:16 linux-4.14.y f6e27dbb1afa c1ad5441 .config log report
ci2-linux-4-14 2019/09/15 16:52 linux-4.14.y e2cd24b62938 32d59357 .config log report
ci2-linux-4-14 2019/09/10 09:04 linux-4.14.y 414510bc00a5 a60cb4cd .config log report
ci2-linux-4-14 2019/09/04 03:06 linux-4.14.y 01fd1694b93c 526709ff .config log report
ci2-linux-4-14 2019/07/23 01:56 linux-4.14.y ff33472c282e 55e0c077 .config log report