syzbot


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

Status: fixed on 2020/11/16 12:12
Subsystems: f2fs
[Documentation on labels]
Reported-by: syzbot+481a3ffab50fed41dcc0@syzkaller.appspotmail.com
Fix commit: 3a22e9ac7158 f2fs: fix to do sanity check on segment/section count
First crash: 1334d, last: 1334d
Cause bisection: failed (error log, bisect log)
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH v2] f2fs: fix to do sanity check on segment/section count 1 (1) 2020/09/29 01:23
KASAN: slab-out-of-bounds Read in f2fs_build_segment_manager 0 (1) 2020/09/25 10:08
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: slab-out-of-bounds Read in f2fs_build_segment_manager C 5 1316d 1334d 0/2 auto-obsoleted due to no activity on 2023/04/17 07:54
linux-4.19 KASAN: slab-out-of-bounds Read in f2fs_build_segment_manager C error 24 557d 1312d 0/1 upstream: reported C repro on 2020/10/17 08:54

Sample crash report:
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): Fix alignment : done, start(4096) end(147456) block(12288)
F2FS-fs (loop0): invalid crc_offset: 0
==================================================================
BUG: KASAN: slab-out-of-bounds in init_min_max_mtime fs/f2fs/segment.c:4710 [inline]
BUG: KASAN: slab-out-of-bounds in f2fs_build_segment_manager+0x9302/0xa6d0 fs/f2fs/segment.c:4792
Read of size 8 at addr ffff8880a1b934a8 by task syz-executor682/6878

CPU: 1 PID: 6878 Comm: syz-executor682 Not tainted 5.9.0-rc6-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+0x198/0x1fd lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 init_min_max_mtime fs/f2fs/segment.c:4710 [inline]
 f2fs_build_segment_manager+0x9302/0xa6d0 fs/f2fs/segment.c:4792
 f2fs_fill_super+0x381a/0x6e80 fs/f2fs/super.c:3633
 mount_bdev+0x32e/0x3f0 fs/super.c:1417
 legacy_get_tree+0x105/0x220 fs/fs_context.c:592
 vfs_get_tree+0x89/0x2f0 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 path_mount+0x1387/0x20a0 fs/namespace.c:3192
 do_mount fs/namespace.c:3205 [inline]
 __do_sys_mount fs/namespace.c:3413 [inline]
 __se_sys_mount fs/namespace.c:3390 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3390
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x446ffa
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffcfc6dc038 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffcfc6dc090 RCX: 0000000000446ffa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffcfc6dc050
RBP: 00007ffcfc6dc050 R08: 00007ffcfc6dc090 R09: 00007ffc00000015
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000008
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

Allocated by task 6878:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 kmalloc_node include/linux/slab.h:577 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:574
 kvmalloc include/linux/mm.h:757 [inline]
 f2fs_kvmalloc fs/f2fs/f2fs.h:3030 [inline]
 f2fs_kvzalloc fs/f2fs/f2fs.h:3036 [inline]
 build_sit_info fs/f2fs/segment.c:4029 [inline]
 f2fs_build_segment_manager+0xb5b/0xa6d0 fs/f2fs/segment.c:4768
 f2fs_fill_super+0x381a/0x6e80 fs/f2fs/super.c:3633
 mount_bdev+0x32e/0x3f0 fs/super.c:1417
 legacy_get_tree+0x105/0x220 fs/fs_context.c:592
 vfs_get_tree+0x89/0x2f0 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 path_mount+0x1387/0x20a0 fs/namespace.c:3192
 do_mount fs/namespace.c:3205 [inline]
 __do_sys_mount fs/namespace.c:3413 [inline]
 __se_sys_mount fs/namespace.c:3390 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3390
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8880a1b93000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1192 bytes inside of
 2048-byte region [ffff8880a1b93000, ffff8880a1b93800)
The buggy address belongs to the page:
page:000000008c03fe3c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xa1b93
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea000275f408 ffffea00025a7548 ffff8880aa040800
raw: 0000000000000000 ffff8880a1b93000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a1b93380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a1b93400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a1b93480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                  ^
 ffff8880a1b93500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a1b93580: 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 (help?) Manager Title
2020/09/25 08:03 upstream 171d4ff79f96 54289b08 .config console log report syz C ci-upstream-kasan-gce-root
2020/09/25 07:41 upstream 171d4ff79f96 54289b08 .config console log report info ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.