syzbot


KASAN: use-after-free Write in ext4_mark_inode_dirty

Status: closed as dup on 2019/11/29 12:55
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+1e407c24e65e1fca3ecf@syzkaller.appspotmail.com
First crash: 1746d, last: 1634d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: use-after-free Write in __ext4_expand_extra_isize (2) ext4 14 1630d 1647d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Write in ext4_mark_inode_dirty 1 (2) 2019/11/29 12:55

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __ext4_expand_extra_isize fs/ext4/inode.c:5924 [inline]
BUG: KASAN: use-after-free in ext4_try_to_expand_extra_isize fs/ext4/inode.c:5976 [inline]
BUG: KASAN: use-after-free in ext4_mark_inode_dirty+0x5a5/0x700 fs/ext4/inode.c:6052
Write of size 4063 at addr ffff8880883bd8a0 by task syz-executor.1/16707

CPU: 1 PID: 16707 Comm: syz-executor.1 Not tainted 5.4.0-rc5+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x2f8 lib/dump_stack.c:113
 print_address_description+0x75/0x5c0 mm/kasan/report.c:374
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:506
 kasan_report+0x26/0x50 mm/kasan/common.c:634
 check_memory_region_inline mm/kasan/generic.c:182 [inline]
 check_memory_region+0x2cf/0x2e0 mm/kasan/generic.c:192
 memset+0x23/0x40 mm/kasan/common.c:105
 __ext4_expand_extra_isize fs/ext4/inode.c:5924 [inline]
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5976 [inline]
 ext4_mark_inode_dirty+0x5a5/0x700 fs/ext4/inode.c:6052
 ext4_evict_inode+0x108e/0x1670 fs/ext4/inode.c:282
 evict+0x2a1/0x6c0 fs/inode.c:574
 iput_final fs/inode.c:1563 [inline]
 iput+0x508/0x690 fs/inode.c:1589
 dentry_unlink_inode+0x2e0/0x3d0 fs/dcache.c:374
 __dentry_kill+0x3e2/0x5e0 fs/dcache.c:579
 dentry_kill fs/dcache.c:673 [inline]
 dput+0x460/0x6f0 fs/dcache.c:859
 path_put+0x39/0x60 fs/namei.c:482
 free_fs_struct fs/fs_struct.c:91 [inline]
 exit_fs+0xed/0x150 fs/fs_struct.c:108
 do_exit+0x59b/0x2190 kernel/exit.c:813
 do_group_exit+0x15c/0x2b0 kernel/exit.c:921
 get_signal+0x4ac/0x1d60 kernel/signal.c:2734
 do_signal+0x37/0x640 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline]
 prepare_exit_to_usermode+0x303/0x580 arch/x86/entry/common.c:194
 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:274
 do_syscall_64+0x11f/0x1c0 arch/x86/entry/common.c:300
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459f49
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd51bd6dcf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000075bf28 RCX: 0000000000459f49
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000075bf28
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000075bf2c
R13: 00007fff2880ccff R14: 00007fd51bd6e9c0 R15: 000000000075bf2c

The buggy address belongs to the page:
page:ffffea000220ef40 refcount:2 mapcount:0 mapping:ffff888219f05520 index:0x42b
def_blk_aops 
flags: 0x1fffc000000203a(referenced|dirty|lru|active|private)
raw: 01fffc000000203a ffffea00021dca08 ffffea0001fd4ec8 ffff888219f05520
raw: 000000000000042b ffff8880953929d8 00000002ffffffff ffff88805511e000
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff88805511e000

Memory state around the buggy address:
 ffff8880883bdf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880883bdf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880883be000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff8880883be080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880883be100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/03 07:23 upstream 9d2345057538 a41ca8fa .config console log report ci-upstream-kasan-gce-smack-root
2019/10/02 09:08 upstream 54ecb8f7028c b7a87a83 .config console log report ci-upstream-kasan-gce-smack-root
2019/08/31 04:15 upstream 6525771f58cb fd37b39e .config console log report ci-upstream-kasan-gce-smack-root
2019/08/31 03:53 upstream 6525771f58cb fd37b39e .config console log report ci-upstream-kasan-gce-smack-root
2019/07/14 06:31 upstream a2d79c7174ae e6fb0f13 .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.