syzbot


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

Status: upstream: reported C repro on 2020/09/25 07:37
Reported-by: syzbot+b68367189599ff1c5061@syzkaller.appspotmail.com
First crash: 856d, last: 837d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in f2fs_build_segment_manager C error 2 856d 856d 17/24 fixed on 2020/11/16 12:12
linux-4.19 KASAN: slab-out-of-bounds Read in f2fs_build_segment_manager C error 24 78d 834d 0/1 upstream: reported C repro on 2020/10/17 08:54

Sample crash report:
F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
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+0x7ed0/0x88b0 fs/f2fs/segment.c:4792
Read of size 8 at addr ffff8881cdc78be0 by task syz-executor072/341

CPU: 0 PID: 341 Comm: syz-executor072 Not tainted 5.4.65-syzkaller-00175-g63d1c2f0b547 #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+0x1b0/0x21e lib/dump_stack.c:118
 print_address_description+0x96/0x5d0 mm/kasan/report.c:374
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:506
 kasan_report+0x27/0x50 mm/kasan/common.c:634
 init_min_max_mtime fs/f2fs/segment.c:4710 [inline]
 f2fs_build_segment_manager+0x7ed0/0x88b0 fs/f2fs/segment.c:4792
 f2fs_fill_super+0x691a/0x9a40 fs/f2fs/super.c:3625
 mount_bdev+0x22d/0x340 fs/super.c:1417
 legacy_get_tree+0xde/0x170 fs/fs_context.c:647
 vfs_get_tree+0x85/0x260 fs/super.c:1547
 do_new_mount fs/namespace.c:2822 [inline]
 do_mount+0x1883/0x2630 fs/namespace.c:3142
 ksys_mount+0xc2/0xf0 fs/namespace.c:3351
 __do_sys_mount fs/namespace.c:3365 [inline]
 __se_sys_mount fs/namespace.c:3362 [inline]
 __x64_sys_mount+0xb1/0xc0 fs/namespace.c:3362
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 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:00007fff06edda68 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff06eddac0 RCX: 0000000000446ffa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fff06edda80
RBP: 00007fff06edda80 R08: 00007fff06eddac0 R09: 00007fff00000015
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000008
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

Allocated by task 341:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x117/0x1b0 mm/kasan/common.c:510
 __kmalloc+0xf7/0x2c0 mm/slub.c:3848
 __kmalloc_node include/linux/slab.h:422 [inline]
 kmalloc_node include/linux/slab.h:599 [inline]
 kvmalloc_node+0xc2/0x120 mm/util.c:564
 kvmalloc include/linux/mm.h:690 [inline]
 f2fs_kvmalloc fs/f2fs/f2fs.h:3027 [inline]
 f2fs_kvzalloc fs/f2fs/f2fs.h:3033 [inline]
 build_sit_info fs/f2fs/segment.c:4029 [inline]
 f2fs_build_segment_manager+0xd5f/0x88b0 fs/f2fs/segment.c:4768
 f2fs_fill_super+0x691a/0x9a40 fs/f2fs/super.c:3625
 mount_bdev+0x22d/0x340 fs/super.c:1417
 legacy_get_tree+0xde/0x170 fs/fs_context.c:647
 vfs_get_tree+0x85/0x260 fs/super.c:1547
 do_new_mount fs/namespace.c:2822 [inline]
 do_mount+0x1883/0x2630 fs/namespace.c:3142
 ksys_mount+0xc2/0xf0 fs/namespace.c:3351
 __do_sys_mount fs/namespace.c:3365 [inline]
 __se_sys_mount fs/namespace.c:3362 [inline]
 __x64_sys_mount+0xb1/0xc0 fs/namespace.c:3362
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8881cdc78800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 992 bytes inside of
 1024-byte region [ffff8881cdc78800, ffff8881cdc78c00)
The buggy address belongs to the page:
page:ffffea0007371e00 refcount:1 mapcount:0 mapping:ffff8881da802280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881da802280
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881cdc78a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881cdc78b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881cdc78b80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                                       ^
 ffff8881cdc78c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881cdc78c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
F2FS-fs (loop0): Failed to read root inode

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-android-5-4-kasan 2020/09/25 08:45 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 54289b08 .config console log report syz C
ci2-android-5-4-kasan 2020/09/25 07:53 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 54289b08 .config console log report syz C
ci2-android-5-4-kasan 2020/10/14 03:16 android12-5.4 2a31fdaad927 fc7735a2 .config console log report info
ci2-android-5-4-kasan 2020/10/11 11:24 android12-5.4 d0e6eb879517 4a77ae0b .config console log report info
ci2-android-5-4-kasan 2020/09/25 07:36 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 54289b08 .config console log report info
* Struck through repros no longer work on HEAD.