syzbot


KASAN: use-after-free Read in f2fs_stop_checkpoint

Status: auto-closed as invalid on 2020/02/24 11:17
Reported-by: syzbot+44c3e10368acc9746af2@syzkaller.appspotmail.com
First crash: 1636d, last: 1636d

Sample crash report:
F2FS-fs (loop1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop1): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop1): Fix alignment : done, start(5120) end(12288) block(6656)
==================================================================
BUG: KASAN: use-after-free in __set_ckpt_flags fs/f2fs/f2fs.h:1385 [inline]
BUG: KASAN: use-after-free in set_ckpt_flags fs/f2fs/f2fs.h:1395 [inline]
BUG: KASAN: use-after-free in f2fs_stop_checkpoint+0x14e/0x160 fs/f2fs/checkpoint.c:31
Read of size 4 at addr ffff88808018e184 by task syz-executor.1/17985

CPU: 1 PID: 17985 Comm: syz-executor.1 Not tainted 4.14.150 #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+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/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/0x2af mm/kasan/report.c:393
 __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report.c:440
 __set_ckpt_flags fs/f2fs/f2fs.h:1385 [inline]
 set_ckpt_flags fs/f2fs/f2fs.h:1395 [inline]
 f2fs_stop_checkpoint+0x14e/0x160 fs/f2fs/checkpoint.c:31
 __get_meta_page+0x836/0x8b0 fs/f2fs/checkpoint.c:90
 get_meta_page fs/f2fs/checkpoint.c:114 [inline]
 get_checkpoint_version+0x66/0x850 fs/f2fs/checkpoint.c:723
 validate_checkpoint+0xb1/0x730 fs/f2fs/checkpoint.c:753
 get_valid_checkpoint+0x1ff/0x1070 fs/f2fs/checkpoint.c:806
 f2fs_fill_super+0x24c9/0x5c10 fs/f2fs/super.c:2534
 mount_bdev+0x2be/0x370 fs/super.c:1134
 f2fs_mount+0x35/0x40 fs/f2fs/super.c:2762
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x417/0x27d0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xab/0x120 fs/namespace.c:3072
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c98a
RSP: 002b:00007f31a171fa88 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f31a171fb40 RCX: 000000000045c98a
RDX: 00007f31a171fae0 RSI: 0000000020000340 RDI: 00007f31a171fb00
RBP: 0000000000000001 R08: 00007f31a171fb40 R09: 00007f31a171fae0
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000003
R13: 00000000004c9570 R14: 00000000004e0d60 R15: 00000000ffffffff

Allocated by task 16374:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc_track_caller+0x159/0x790 mm/slab.c:3735
 kstrdup+0x3a/0x70 mm/util.c:56
 simple_xattr_set+0x5d/0x590 fs/xattr.c:885
 shmem_xattr_handler_set+0x42/0x50 mm/shmem.c:3392
 __vfs_setxattr+0xd8/0x130 fs/xattr.c:150
 __vfs_setxattr_noperm+0x102/0x3c0 fs/xattr.c:181
 vfs_setxattr+0xc5/0xf0 fs/xattr.c:224
 setxattr+0x1de/0x350 fs/xattr.c:453
 path_setxattr+0x11f/0x140 fs/xattr.c:472
 SYSC_lsetxattr fs/xattr.c:494 [inline]
 SyS_lsetxattr+0x38/0x50 fs/xattr.c:490
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 16374:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 simple_xattr_set+0x26b/0x590 fs/xattr.c:916
 shmem_xattr_handler_set+0x42/0x50 mm/shmem.c:3392
 __vfs_setxattr+0xd8/0x130 fs/xattr.c:150
 __vfs_setxattr_noperm+0x102/0x3c0 fs/xattr.c:181
 vfs_setxattr+0xc5/0xf0 fs/xattr.c:224
 setxattr+0x1de/0x350 fs/xattr.c:453
 path_setxattr+0x11f/0x140 fs/xattr.c:472
 SYSC_lsetxattr fs/xattr.c:494 [inline]
 SyS_lsetxattr+0x38/0x50 fs/xattr.c:490
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88808018e180
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 4 bytes inside of
 32-byte region [ffff88808018e180, ffff88808018e1a0)
The buggy address belongs to the page:
page:ffffea0002006380 count:1 mapcount:0 mapping:ffff88808018e000 index:0xffff88808018efc1
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff88808018e000 ffff88808018efc1 000000010000003f
raw: ffffea000266f7a0 ffffea00027f2960 ffff8880aa8001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808018e080: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff88808018e100: 01 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc
>ffff88808018e180: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                   ^
 ffff88808018e200: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff88808018e280: fb fb fb fb fc fc fc fc 00 04 fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/27 11:16 linux-4.14.y b98aebd29824 25bb509e .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.