syzbot


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

Status: auto-closed as invalid on 2021/02/06 17:39
Reported-by: syzbot+20574e0eacdbd09cf597@syzkaller.appspotmail.com
First crash: 1517d, last: 1509d

Sample crash report:
RBP: 00007fed135c4ae0 R08: 00007fed135c4b20 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 0000000020000200 R15: 0000000020000040
---[ end trace 50a9e9c3c12f2443 ]---
==================================================================
BUG: KASAN: slab-out-of-bounds in seg_info_from_raw_sit fs/f2fs/segment.h:351 [inline]
BUG: KASAN: slab-out-of-bounds in build_sit_entries fs/f2fs/segment.c:4216 [inline]
BUG: KASAN: slab-out-of-bounds in f2fs_build_segment_manager+0x45ed/0x8880 fs/f2fs/segment.c:4779
Write of size 64 at addr ffff88816e819200 by task syz-executor.4/20864

CPU: 0 PID: 20864 Comm: syz-executor.4 Tainted: G        W         5.4.70-syzkaller-00063-gd0e6eb879517 #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
 check_memory_region_inline mm/kasan/generic.c:181 [inline]
 check_memory_region+0x2b5/0x2f0 mm/kasan/generic.c:191
 memcpy+0x38/0x50 mm/kasan/common.c:123
 seg_info_from_raw_sit fs/f2fs/segment.h:351 [inline]
 build_sit_entries fs/f2fs/segment.c:4216 [inline]
 f2fs_build_segment_manager+0x45ed/0x8880 fs/f2fs/segment.c:4779
 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:0x46087a
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 ad 89 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 8a 89 fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007fed135c4a88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fed135c4b20 RCX: 000000000046087a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fed135c4ae0
RBP: 00007fed135c4ae0 R08: 00007fed135c4b20 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 0000000020000200 R15: 0000000020000040

Allocated by task 20864:
 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:3863
 __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:4046 [inline]
 f2fs_build_segment_manager+0xe57/0x8880 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 ffff88816e818000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 4608 bytes inside of
 8192-byte region [ffff88816e818000, ffff88816e81a000)
The buggy address belongs to the page:
page:ffffea0005ba0600 refcount:1 mapcount:0 mapping:ffff8881da80c500 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881da80c500
raw: 0000000000000000 0000000080020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88816e819100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88816e819180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88816e819200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88816e819280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88816e819300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
------------[ cut here ]------------
WARNING: CPU: 0 PID: 20864 at fs/f2fs/segment.h:657 check_seg_range fs/f2fs/segment.c:4201 [inline]
WARNING: CPU: 0 PID: 20864 at fs/f2fs/segment.h:657 current_sit_addr fs/f2fs/segment.h:721 [inline]
WARNING: CPU: 0 PID: 20864 at fs/f2fs/segment.h:657 get_current_sit_page fs/f2fs/segment.c:3784 [inline]
WARNING: CPU: 0 PID: 20864 at fs/f2fs/segment.h:657 build_sit_entries fs/f2fs/segment.c:4206 [inline]
WARNING: CPU: 0 PID: 20864 at fs/f2fs/segment.h:657 f2fs_build_segment_manager+0x4958/0x8880 fs/f2fs/segment.c:4779
Modules linked in:
CPU: 0 PID: 20864 Comm: syz-executor.4 Tainted: G    B   W         5.4.70-syzkaller-00063-gd0e6eb879517 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:check_seg_range fs/f2fs/segment.c:4201 [inline]
RIP: 0010:current_sit_addr fs/f2fs/segment.h:721 [inline]
RIP: 0010:get_current_sit_page fs/f2fs/segment.c:3784 [inline]
RIP: 0010:build_sit_entries fs/f2fs/segment.c:4206 [inline]
RIP: 0010:f2fs_build_segment_manager+0x4958/0x8880 fs/f2fs/segment.c:4779
Code: c8 00 00 00 45 85 e4 0f 84 b9 02 00 00 48 ff 44 24 10 e8 8b 5d 6f ff 41 ff cc 48 83 44 24 48 28 e9 fa f8 ff ff e8 78 5d 6f ff <0f> 0b 48 8b 9c 24 10 01 00 00 48 89 df be 08 00 00 00 e8 21 ed 9c
RSP: 0018:ffff8881d4797700 EFLAGS: 00010246
RAX: ffffffff81d20a38 RBX: 000000000000001e RCX: 0000000000040000
RDX: ffffc9000242b000 RSI: 000000000003ffff RDI: 0000000000040000
RBP: ffff8881d4797910 R08: ffffffff81d204b1 R09: ffff88816e819700
R10: ffffed102dd032e8 R11: 00000000000000fc R12: 0000000000000000
R13: ffff8881d45bea5c R14: 000000000000001f R15: 0000000000000600
FS:  00007fed135c5700(0000) GS:ffff8881db800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f779ba62000 CR3: 0000000197789005 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 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:0x46087a
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 ad 89 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 8a 89 fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007fed135c4a88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fed135c4b20 RCX: 000000000046087a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fed135c4ae0
RBP: 00007fed135c4ae0 R08: 00007fed135c4b20 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 0000000020000200 R15: 0000000020000040
---[ end trace 50a9e9c3c12f2444 ]---
F2FS-fs (loop4): Wrong valid blocks 0 or segno 31
F2FS-fs (loop4): Failed to initialize F2FS segment manager (-117)

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/09 17:38 android12-5.4 d0e6eb879517 fa79ed2a .config console log report info ci2-android-5-4-kasan
2020/10/08 07:59 android12-5.4 54d2c66faf42 1880b4a9 .config console log report info ci2-android-5-4-kasan
2020/10/07 07:02 android12-5.4 489646b879ed 1880b4a9 .config console log report info ci2-android-5-4-kasan
2020/10/01 04:21 android12-5.4 2a7d52383a14 a9767fb2 .config console log report info ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.