bisecting fixing commit since 2c8a3fceddf0dd87f278e7a5e01350f86f844b1c building syzkaller on 98682e5e2aefc9aad61354f4f3ac93be96002a2a testing commit 2c8a3fceddf0dd87f278e7a5e01350f86f844b1c with gcc (GCC) 8.4.1 20210217 kernel signature: 47c295e5a77beb20f5d53787b89751d0b29fe6f7a85cb5d8cc2ae2aaa91366b9 all runs: crashed: KASAN: use-after-free Read in f2fs_evict_inode testing current HEAD 0cc244011f40280b78fc344d5c2aac5a0c659f77 testing commit 0cc244011f40280b78fc344d5c2aac5a0c659f77 with gcc (GCC) 8.4.1 20210217 kernel signature: 5aba0f1ab9d775ea3bc6f753551dd845931b25f980756f462eb32fe79887b5eb all runs: crashed: KASAN: use-after-free Read in f2fs_evict_inode revisions tested: 2, total time: 21m36.866419912s (build: 14m3.671335068s, test: 7m2.438460586s) the crash still happens on HEAD commit msg: Linux 4.14.229 crash: KASAN: use-after-free Read in f2fs_evict_inode F2FS-fs (loop1): Can't find valid F2FS filesystem in 2th superblock F2FS-fs (loop5): Try to recover 2th superblock, ret: 0 F2FS-fs (loop1): invalid crc value F2FS-fs (loop5): Mounted with checkpoint version = 1e177019 ================================================================== BUG: KASAN: use-after-free in f2fs_evict_inode+0xc63/0xf70 fs/f2fs/inode.c:544 Read of size 4 at addr ffff888083923530 by task syz-executor.2/12669 CPU: 0 PID: 12669 Comm: syz-executor.2 Not tainted 4.14.229-syzkaller #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+0x14b/0x1e7 lib/dump_stack.c:58 print_address_description.cold.6+0x9/0x1ca 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.7+0x11a/0x2d3 mm/kasan/report.c:393 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429 f2fs_evict_inode+0xc63/0xf70 fs/f2fs/inode.c:544 evict+0x29c/0x590 fs/inode.c:555 iput_final fs/inode.c:1524 [inline] iput fs/inode.c:1551 [inline] iput+0x3ac/0x810 fs/inode.c:1536 dentry_unlink_inode+0x22d/0x2e0 fs/dcache.c:387 __dentry_kill+0x2d2/0x540 fs/dcache.c:591 shrink_dentry_list+0x265/0x920 fs/dcache.c:1069 shrink_dcache_sb+0x108/0x1b0 fs/dcache.c:1191 f2fs_fill_super fs/f2fs/super.c:2767 [inline] f2fs_fill_super+0xeb2/0x5d70 fs/f2fs/super.c:2389 mount_bdev+0x26f/0x330 fs/super.c:1134 f2fs_mount+0x10/0x20 fs/f2fs/super.c:2776 mount_fs+0x7f/0x270 fs/super.c:1237 vfs_kern_mount.part.9+0x58/0x3c0 fs/namespace.c:1046 vfs_kern_mount fs/namespace.c:1036 [inline] do_new_mount fs/namespace.c:2549 [inline] do_mount+0x352/0x2af0 fs/namespace.c:2879 SYSC_mount fs/namespace.c:3095 [inline] SyS_mount+0xb1/0xd0 fs/namespace.c:3072 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x4672ba RSP: 002b:00007fbeacd41fa8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00000000004672ba RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fbeacd42000 RBP: 00007fbeacd42040 R08: 00007fbeacd42040 R09: 0000000020000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020000000 R13: 0000000020000100 R14: 00007fbeacd42000 R15: 0000000020000300 Allocated by task 12669: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:551 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:536 kmem_cache_alloc_trace+0x152/0x3f0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] f2fs_fill_super fs/f2fs/super.c:2407 [inline] f2fs_fill_super+0xe0/0x5d70 fs/f2fs/super.c:2389 mount_bdev+0x26f/0x330 fs/super.c:1134 f2fs_mount+0x10/0x20 fs/f2fs/super.c:2776 mount_fs+0x7f/0x270 fs/super.c:1237 vfs_kern_mount.part.9+0x58/0x3c0 fs/namespace.c:1046 vfs_kern_mount fs/namespace.c:1036 [inline] do_new_mount fs/namespace.c:2549 [inline] do_mount+0x352/0x2af0 fs/namespace.c:2879 SYSC_mount fs/namespace.c:3095 [inline] SyS_mount+0xb1/0xd0 fs/namespace.c:3072 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 12669: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xab/0x190 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 f2fs_fill_super fs/f2fs/super.c:2762 [inline] f2fs_fill_super+0xe99/0x5d70 fs/f2fs/super.c:2389 mount_bdev+0x26f/0x330 fs/super.c:1134 f2fs_mount+0x10/0x20 fs/f2fs/super.c:2776 mount_fs+0x7f/0x270 fs/super.c:1237 vfs_kern_mount.part.9+0x58/0x3c0 fs/namespace.c:1046 vfs_kern_mount fs/namespace.c:1036 [inline] do_new_mount fs/namespace.c:2549 [inline] do_mount+0x352/0x2af0 fs/namespace.c:2879 SYSC_mount fs/namespace.c:3095 [inline] SyS_mount+0xb1/0xd0 fs/namespace.c:3072 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff888083922c00 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 2352 bytes inside of 4096-byte region [ffff888083922c00, ffff888083923c00) The buggy address belongs to the page: page:ffffea00020e4880 count:1 mapcount:0 mapping:ffff888083922c00 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffff888083922c00 0000000000000000 0000000100000001 raw: ffffea00023b5f20 ffffea00020e5120 ffff88813fe60dc0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888083923400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888083923480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888083923500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888083923580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888083923600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================