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

Status: fixed on 2020/09/11 09:49
Fix commit: 0900097ef667 fs/minix: reject too-large maximum file size
First crash: 1051d, last: 1021d

Fix bisection: fixed by (bisect log) :
commit 0900097ef667097b0a4afb0155a4f5add77ece19
Author: Eric Biggers <>
Date: Wed Aug 12 01:35:30 2020 +0000

  fs/minix: reject too-large maximum file size

Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in get_block 1 1051d 1047d 0/24 auto-closed as invalid on 2020/11/09 17:42
linux-4.19 KASAN: slab-out-of-bounds Read in get_block C done 3 1021d 1136d 1/1 fixed on 2020/09/11 21:52
upstream KASAN: slab-out-of-bounds Read in get_block (2) fs 1 140d 140d 0/24 auto-obsoleted due to no activity on 2023/05/09 01:15

Sample crash report:
audit: type=1800 audit(1594576603.343:9): pid=6356 uid=0 auid=0 ses=5 subj=system_u:system_r:kernel_t:s0 op="collect_data" cause="failed(directio)" comm="syz-executor063" 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+0xe06/0x1100 fs/minix/itree_common.c:160
Read of size 2 at addr ffff88808f8a018a by task syz-executor063/6356

CPU: 1 PID: 6356 Comm: syz-executor063 Not tainted 4.14.184-syzkaller #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+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/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/0x2b9 mm/kasan/report.c:393
 add_chain fs/minix/itree_common.c:14 [inline]
 get_branch fs/minix/itree_common.c:52 [inline]
 get_block+0xe06/0x1100 fs/minix/itree_common.c:160
 minix_get_block+0xd6/0x100 fs/minix/inode.c:379
 __block_write_begin_int+0x33a/0x1000 fs/buffer.c:2038
 __block_write_begin fs/buffer.c:2088 [inline]
 block_write_begin+0x58/0x260 fs/buffer.c:2147
 minix_write_begin+0x35/0xc0 fs/minix/inode.c:415
 generic_perform_write+0x1c9/0x420 mm/filemap.c:3047
 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3172
 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3200
 call_write_iter include/linux/fs.h:1778 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x44e/0x630 fs/read_write.c:482
 __kernel_write+0xf5/0x330 fs/read_write.c:501
 do_acct_process+0xb49/0xf60 kernel/acct.c:520
 slow_acct_process kernel/acct.c:579 [inline]
 acct_process+0x38a/0x422 kernel/acct.c:605
 do_exit+0x1728/0x2ae0 kernel/exit.c:848
 do_group_exit+0x100/0x2e0 kernel/exit.c:955
 SYSC_exit_group kernel/exit.c:966 [inline]
 SyS_exit_group+0x19/0x20 kernel/exit.c:964
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
RIP: 0033:0x443e28
RSP: 002b:00007ffcab085fd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000443e28
RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
RBP: 00000000004c4af0 R08: 00000000000000e7 R09: ffffffffffffffd4
R10: 00007ffcab085ef0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d7180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6284:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 getname_flags+0xc8/0x550 fs/namei.c:138
 do_sys_open+0x202/0x3e0 fs/open.c:1075
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292

Freed by task 6284:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 putname+0xcd/0x110 fs/namei.c:259
 do_sys_open+0x233/0x3e0 fs/open.c:1090
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292

The buggy address belongs to the object at ffff88808f8a0580
 which belongs to the cache names_cache of size 4096
The buggy address is located 1014 bytes to the left of
 4096-byte region [ffff88808f8a0580, ffff88808f8a1580)
The buggy address belongs to the page:
page:ffffea00023e2800 count:1 mapcount:0 mapping:ffff88808f8a0580 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88808f8a0580 0000000000000000 0000000100000001
raw: ffffea00023e47a0 ffffea00023e2920 ffff8880aa9dacc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808f8a0080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88808f8a0100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88808f8a0180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88808f8a0200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88808f8a0280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2020/07/12 17:59 linux-4.14.y b850307b279c 115e1930 .config console log report syz C ci2-linux-4-14
2020/07/12 17:43 linux-4.14.y b850307b279c 115e1930 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.