syzbot


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

Status: upstream: reported C repro on 2022/10/21 06:35
Reported-by: syzbot+16fb4e220a3a2681bfeb@syzkaller.appspotmail.com
First crash: 776d, last: 776d
Fix bisection: failed (error log, bisect log)
  

Sample crash report:
F2FS-fs (loop0): Invalid blocksize (65536), supports only 4KB
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): Found nat_bits in checkpoint
F2FS-fs (loop0): Mounted with checkpoint version = 3e17dab1
==================================================================
BUG: KASAN: slab-out-of-bounds in datablock_addr fs/f2fs/f2fs.h:2163 [inline]
BUG: KASAN: slab-out-of-bounds in is_alive+0xab1/0xb80 fs/f2fs/gc.c:593
Read of size 4 at addr ffff88809adf6150 by task syz-executor379/8124

CPU: 1 PID: 8124 Comm: syz-executor379 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432
 datablock_addr fs/f2fs/f2fs.h:2163 [inline]
 is_alive+0xab1/0xb80 fs/f2fs/gc.c:593
 gc_data_segment fs/f2fs/gc.c:944 [inline]
 do_garbage_collect fs/f2fs/gc.c:1109 [inline]
 f2fs_gc+0x1e26/0x8c90 fs/f2fs/gc.c:1196
 f2fs_balance_fs+0x71a/0xd80 fs/f2fs/segment.c:513
 __write_data_page+0xab8/0x22d0 fs/f2fs/data.c:1975
 f2fs_write_cache_pages+0x96e/0x13e0 fs/f2fs/data.c:2107
 __f2fs_write_data_pages fs/f2fs/data.c:2217 [inline]
 f2fs_write_data_pages+0xcc3/0x1060 fs/f2fs/data.c:2244
 do_writepages+0xe5/0x290 mm/page-writeback.c:2344
 __filemap_fdatawrite_range+0x27d/0x350 mm/filemap.c:446
 file_write_and_wait_range+0x93/0x100 mm/filemap.c:776
 f2fs_do_sync_file+0x2eb/0x2550 fs/f2fs/file.c:228
 f2fs_sync_file+0x136/0x190 fs/f2fs/file.c:334
 vfs_fsync_range+0x13a/0x220 fs/sync.c:197
 generic_write_sync include/linux/fs.h:2750 [inline]
 f2fs_file_write_iter+0x64b/0xbe0 fs/f2fs/file.c:3044
 call_write_iter include/linux/fs.h:1821 [inline]
 do_iter_readv_writev+0x668/0x790 fs/read_write.c:681
 do_iter_write+0x182/0x5d0 fs/read_write.c:960
 vfs_iter_write+0x70/0xa0 fs/read_write.c:973
 iter_file_splice_write+0x60d/0xbb0 fs/splice.c:750
 do_splice_from fs/splice.c:852 [inline]
 direct_splice_actor+0x115/0x160 fs/splice.c:1025
 splice_direct_to_actor+0x33f/0x8d0 fs/splice.c:980
 do_splice_direct+0x1a7/0x270 fs/splice.c:1068
 do_sendfile+0x550/0xc30 fs/read_write.c:1447
 __do_sys_sendfile64 fs/read_write.c:1508 [inline]
 __se_sys_sendfile64+0x147/0x160 fs/read_write.c:1494
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f717e4d5509
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffed45bdb58 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 0000000800000000 RCX: 00007f717e4d5509
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00007f717e544ec0 R09: 00007f717e544ec0
R10: 0001000000201005 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000

Allocated by task 6235:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 getname_flags+0xce/0x590 fs/namei.c:140
 do_sys_open+0x26c/0x520 fs/open.c:1079
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6235:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 putname+0xe1/0x120 fs/namei.c:261
 do_sys_open+0x2ba/0x520 fs/open.c:1094
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809adf6580
 which belongs to the cache names_cache of size 4096
The buggy address is located 1072 bytes to the left of
 4096-byte region [ffff88809adf6580, ffff88809adf7580)
The buggy address belongs to the page:
page:ffffea00026b7d80 count:1 mapcount:0 mapping:ffff88823b843380 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea00026b7d08 ffffea000265b408 ffff88823b843380
raw: 0000000000000000 ffff88809adf6580 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809adf6000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809adf6080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809adf6100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                 ^
 ffff88809adf6180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809adf6200: fc fc fc fc fc fc fc fc fc fc 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
2022/10/21 06:34 linux-4.19.y 3f8a27f9e27b a0fd4dab .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: slab-out-of-bounds Read in is_alive
* Struck through repros no longer work on HEAD.