syzbot


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

Status: upstream: reported C repro on 2020/10/05 08:04
Subsystems: f2fs
[Documentation on labels]
Reported-by: syzbot+9dbc2a111dea6d6ddde3@syzkaller.appspotmail.com
First crash: 1358d, last: 501d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in build_segment_manager f2fs C 1 2257d 2257d 8/27 fixed on 2018/07/09 18:05
android-49 KASAN: slab-out-of-bounds Read in build_segment_manager C 1 2257d 2257d 0/3 closed as invalid on 2020/03/24 18:50
linux-4.14 KASAN: null-ptr-deref Write in build_segment_manager (2) 1 931d 931d 0/1 auto-closed as invalid on 2022/04/05 03:48
linux-4.14 KASAN: null-ptr-deref Write in build_segment_manager 1 1360d 1360d 0/1 auto-closed as invalid on 2021/01/31 08:13
Fix bisection attempts (25)
Created Duration User Patch Repo Result
2022/10/13 02:12 0m bisect fix linux-4.14.y error job log (0)
2022/08/30 06:21 26m bisect fix linux-4.14.y job log (0) log
2022/07/17 10:53 25m bisect fix linux-4.14.y job log (0) log
2022/06/17 10:25 28m bisect fix linux-4.14.y job log (0) log
2022/05/18 09:59 25m bisect fix linux-4.14.y job log (0) log
2022/04/18 09:36 23m bisect fix linux-4.14.y job log (0) log
2022/03/19 04:45 28m bisect fix linux-4.14.y job log (0) log
2022/02/15 23:35 31m bisect fix linux-4.14.y job log (0) log
2022/01/16 23:03 31m bisect fix linux-4.14.y job log (0) log
2021/12/17 22:37 25m bisect fix linux-4.14.y job log (0) log
2021/11/17 22:11 25m bisect fix linux-4.14.y job log (0) log
2021/10/18 21:42 28m bisect fix linux-4.14.y job log (0) log
2021/09/18 21:16 26m bisect fix linux-4.14.y job log (0) log
2021/08/19 20:43 27m bisect fix linux-4.14.y job log (0) log
2021/07/20 19:55 27m bisect fix linux-4.14.y job log (0) log
2021/06/20 19:08 29m bisect fix linux-4.14.y job log (0) log
2021/05/21 05:25 32m bisect fix linux-4.14.y job log (0) log
2021/04/21 04:41 21m bisect fix linux-4.14.y job log (0) log
2021/03/22 04:09 22m bisect fix linux-4.14.y job log (0) log
2021/02/20 03:29 20m bisect fix linux-4.14.y job log (0) log
2021/02/17 17:18 19m bisect fix linux-4.14.y error job log (0)
2021/02/02 23:22 1m bisect fix linux-4.14.y error job log (0)
2021/01/03 22:04 22m bisect fix linux-4.14.y job log (0) log
2020/12/04 21:16 25m bisect fix linux-4.14.y job log (0) log
2020/11/04 08:33 22m bisect fix linux-4.14.y job log (0) log

Sample crash report:
F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
F2FS-fs (loop0): invalid crc value
==================================================================
BUG: KASAN: slab-out-of-bounds in build_sit_entries fs/f2fs/segment.c:3299 [inline]
BUG: KASAN: slab-out-of-bounds in build_segment_manager+0x7ca3/0x80e0 fs/f2fs/segment.c:3567
Read of size 4 at addr ffff8880a925b5a4 by task syz-executor283/7974

CPU: 0 PID: 7974 Comm: syz-executor283 Not tainted 4.14.289-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 build_sit_entries fs/f2fs/segment.c:3299 [inline]
 build_segment_manager+0x7ca3/0x80e0 fs/f2fs/segment.c:3567
 f2fs_fill_super+0x2e21/0x56a0 fs/f2fs/super.c:2581
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2572 [inline]
 do_mount+0xe65/0x2a30 fs/namespace.c:2905
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f78529d43aa
RSP: 002b:00007ffff50e23e8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffff50e2440 RCX: 00007f78529d43aa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffff50e2400
RBP: 00007ffff50e2400 R08: 00007ffff50e2440 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000286 R12: 00000000200002a8
R13: 0000000000000003 R14: 0000000000000004 R15: 0000000000000007

Allocated by task 7974:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x4c/0x70 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:530 [inline]
 kvmalloc_node+0x46/0xd0 mm/util.c:430
 kvmalloc include/linux/mm.h:531 [inline]
 kvzalloc include/linux/mm.h:539 [inline]
 build_sit_info fs/f2fs/segment.c:3147 [inline]
 build_segment_manager+0xeb9/0x80e0 fs/f2fs/segment.c:3556
 f2fs_fill_super+0x2e21/0x56a0 fs/f2fs/super.c:2581
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2572 [inline]
 do_mount+0xe65/0x2a30 fs/namespace.c:2905
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880a925b580
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 36 bytes inside of
 64-byte region [ffff8880a925b580, ffff8880a925b5c0)
The buggy address belongs to the page:
page:ffffea0002a496c0 count:1 mapcount:0 mapping:ffff8880a925b000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a925b000 0000000000000000 0000000100000020
raw: ffffea0002651920 ffffea0002acc060 ffff88813fe74340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a925b480: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880a925b500: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff8880a925b580: 00 00 00 00 04 fc fc fc fc fc fc fc fc fc fc fc
                               ^
 ffff8880a925b600: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880a925b680: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/07/28 22:31 linux-4.14.y 9c3bf9cf362f fb95c74d .config console log report syz C ci2-linux-4-14 KASAN: slab-out-of-bounds Read in build_segment_manager
2020/10/05 08:33 linux-4.14.y cbfa1702aaf6 5ef9c291 .config console log report syz C ci2-linux-4-14
2020/10/05 08:02 linux-4.14.y cbfa1702aaf6 5ef9c291 .config console log report syz C ci2-linux-4-14
2023/02/10 00:47 linux-4.14.y a8ad60f2af58 07980f9d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: null-ptr-deref Write in build_segment_manager
2022/10/18 07:43 linux-4.14.y 9d5c0b3a8e1a 94744d21 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 KASAN: null-ptr-deref Write in build_segment_manager
* Struck through repros no longer work on HEAD.