syzbot


KASAN: slab-out-of-bounds Read in get_block

Status: fixed on 2020/09/11 21:52
Reported-by: syzbot+f77070592e2450481fe2@syzkaller.appspotmail.com
Fix commit: 954fc7da99a9 fs/minix: reject too-large maximum file size
First crash: 852d, last: 737d

Fix bisection: fixed by (bisect log) :
commit 954fc7da99a9513d5e6b3ccf38f6f7c9af5a276d
Author: Eric Biggers <ebiggers@google.com>
Date: Wed Aug 12 01:35:30 2020 +0000

  fs/minix: reject too-large maximum file size

similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in get_block 1 767d 763d 0/23 auto-closed as invalid on 2020/11/09 17:42
linux-4.14 KASAN: slab-out-of-bounds Read in get_block C done 2 737d 767d 1/1 fixed on 2020/09/11 09:49

Sample crash report:
audit: type=1800 audit(1594583227.723:9): pid=6661 uid=0 auid=0 ses=5 subj=system_u:system_r:kernel_t:s0 op=collect_data cause=failed(directio) comm="syz-executor291" name="file0" dev="sda1" ino=15707 res=0
MINIX-fs: mounting unchecked file system, running fsck is recommended
Process accounting resumed
==================================================================
BUG: KASAN: slab-out-of-bounds in add_chain fs/minix/itree_common.c:14 [inline]
BUG: KASAN: slab-out-of-bounds in get_branch fs/minix/itree_common.c:52 [inline]
BUG: KASAN: slab-out-of-bounds in get_block+0x1085/0x1340 fs/minix/itree_common.c:160
Read of size 2 at addr ffff88809546a18a by task syz-executor291/6661

CPU: 0 PID: 6661 Comm: syz-executor291 Not tainted 4.19.132-syzkaller #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+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load2_noabort+0x88/0x90 mm/kasan/report.c:431
 add_chain fs/minix/itree_common.c:14 [inline]
 get_branch fs/minix/itree_common.c:52 [inline]
 get_block+0x1085/0x1340 fs/minix/itree_common.c:160
 minix_get_block+0xe5/0x110 fs/minix/inode.c:379
 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978
 __block_write_begin fs/buffer.c:2028 [inline]
 block_write_begin+0x58/0x2e0 fs/buffer.c:2087
 minix_write_begin+0x35/0x220 fs/minix/inode.c:415
 generic_perform_write+0x1f8/0x4d0 mm/filemap.c:3162
 __generic_file_write_iter+0x24b/0x610 mm/filemap.c:3287
 generic_file_write_iter+0x3f8/0x729 mm/filemap.c:3315
 call_write_iter include/linux/fs.h:1821 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x51b/0x770 fs/read_write.c:487
 __kernel_write+0x109/0x370 fs/read_write.c:506
 do_acct_process+0xcbe/0x10c0 kernel/acct.c:520
 slow_acct_process kernel/acct.c:579 [inline]
 acct_process+0x49f/0x5e2 kernel/acct.c:605
 do_exit+0x15fb/0x2b70 kernel/exit.c:877
 do_group_exit+0x125/0x310 kernel/exit.c:990
 __do_sys_exit_group kernel/exit.c:1001 [inline]
 __se_sys_exit_group kernel/exit.c:999 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:999
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x447dc8
Code: Bad RIP value.
RSP: 002b:00007ffd73729388 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000447dc8
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004caf10 R08: 00000000000000e7 R09: ffffffffffffffd4
R10: 00007ffd737292a0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006e47e0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 1:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 getname_flags+0xce/0x590 fs/namei.c:140
 do_sys_open+0x26c/0x520 fs/open.c:1079
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 putname+0xe1/0x120 fs/namei.c:261
 do_sys_open+0x2ba/0x520 fs/open.c:1094
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809546ae80
 which belongs to the cache names_cache of size 4096
The buggy address is located 3318 bytes to the left of
 4096-byte region [ffff88809546ae80, ffff88809546be80)
The buggy address belongs to the page:
page:ffffea0002551a80 count:1 mapcount:0 mapping:ffff8880aa00ab40 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002526588 ffffea0002510608 ffff8880aa00ab40
raw: 0000000000000000 ffff88809546ae80 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809546a080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809546a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809546a180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                      ^
 ffff88809546a200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809546a280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2020/07/12 19:50 linux-4.19.y dce0f88600e4 9ebcc5b1 .config log report syz C
ci2-linux-4-19 2020/05/19 14:21 linux-4.19.y 258f0cf7ac3b 6d882fd2 .config log report
ci2-linux-4-19 2020/04/18 12:40 linux-4.19.y 8488c3f3bc86 435c6d53 .config log report