syzbot


KASAN: stack-out-of-bounds Read in find_inode_nowait

Status: fixed on 2018/08/07 13:43
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+8e22e39b41f695f38657@syzkaller.appspotmail.com
Fix commit: 99ba2b5aba24 bpf: sockhash, disallow bpf_tcp_close and update in parallel
First crash: 2208d, last: 2208d

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in find_inode_nowait+0x17b/0x190 fs/inode.c:1385
Read of size 8 at addr ffff8801944404e0 by task syz-executor1/4493

CPU: 0 PID: 4493 Comm: syz-executor1 Not tainted 4.18.0-rc3+ #48
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 find_inode_nowait+0x17b/0x190 fs/inode.c:1385
 ext4_update_other_inodes_time fs/ext4/inode.c:5126 [inline]
 ext4_do_update_inode fs/ext4/inode.c:5252 [inline]
 ext4_mark_iloc_dirty+0x257b/0x30b0 fs/ext4/inode.c:5772
 ext4_mark_inode_dirty+0x246/0xb50 fs/ext4/inode.c:5951
 add_dirent_to_buf+0x44d/0x6c0 fs/ext4/namei.c:1889
 ext4_add_entry+0x57c/0xc10 fs/ext4/namei.c:2082
 ext4_mkdir+0x7e4/0xe60 fs/ext4/namei.c:2639
 vfs_mkdir+0x42e/0x6b0 fs/namei.c:3827
 do_mkdirat+0x27b/0x310 fs/namei.c:3850
 __do_sys_mkdir fs/namei.c:3866 [inline]
 __se_sys_mkdir fs/namei.c:3864 [inline]
 __x64_sys_mkdir+0x5c/0x80 fs/namei.c:3864
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455267
Code: 1f 40 00 b8 5a 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 cd c5 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 53 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 ad c5 fb ff c3 66 2e 0f 1f 84 00 00 00 00 
RSP: 002b:00007ffd28f17828 EFLAGS: 00000206 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007ffd28f17850 RCX: 0000000000455267
RDX: 00007ffd28f18506 RSI: 00000000000001ff RDI: 00007ffd28f18500
RBP: 0000000000000013 R08: 0000000000000000 R09: 0000000000000006
R10: 0000000000000064 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000001380 R14: 00007ffd28f17ed0 R15: 00000000007034c0

Allocated by task 0:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
 ext4_alloc_inode+0xc9/0x880 fs/ext4/super.c:1000
 alloc_inode+0x63/0x190 fs/inode.c:210
 new_inode_pseudo+0x71/0x1a0 fs/inode.c:895
 new_inode+0x1c/0x40 fs/inode.c:924
 __ext4_new_inode+0x449/0x6060 fs/ext4/ialloc.c:817
 ext4_create+0x2e8/0x640 fs/ext4/namei.c:2445
 lookup_open+0x13eb/0x1b40 fs/namei.c:3220
 do_last fs/namei.c:3311 [inline]
 path_openat+0x1343/0x4e10 fs/namei.c:3540
 do_filp_open+0x255/0x380 fs/namei.c:3574
 do_sys_open+0x584/0x760 fs/open.c:1101
 __do_sys_open fs/open.c:1119 [inline]
 __se_sys_open fs/open.c:1114 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1114
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff880194440180
 which belongs to the cache ext4_inode_cache of size 1968
The buggy address is located 864 bytes inside of
 1968-byte region [ffff880194440180, ffff880194440930)
The buggy address belongs to the page:
page:ffffea0006511000 count:1 mapcount:0 mapping:ffff8801d3e949c0 index:0xffff880194440fff
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea000664c0c8 ffffea0007241348 ffff8801d3e949c0
raw: ffff880194440fff ffff880194440180 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff880194440380: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff880194440400: 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 f2
>ffff880194440480: f2 f2 f2 00 f2 f2 f2 f2 f2 f2 f2 00 f2 f2 f2 f2
                                                       ^
 ffff880194440500: f2 f2 f2 f8 f2 f2 f2 f2 f2 f2 f2 00 f2 f2 f2 00
 ffff880194440580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/07/09 06:30 bpf-next d90c936fb318 f25e5770 .config console log report ci-upstream-bpf-next-kasan-gce
* Struck through repros no longer work on HEAD.