syzbot


KASAN: stack-out-of-bounds Read in find_get_entries

Status: auto-obsoleted due to no activity on 2023/08/25 18:39
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+1ee77d09dc3339ad29db@syzkaller.appspotmail.com
First crash: 332d, last: 332d

Sample crash report:
loop0: detected capacity change from 0 to 4096
==================================================================
BUG: KASAN: stack-out-of-bounds in find_get_entries+0xa21/0xaf0 mm/filemap.c:2061
Read of size 1 at addr ffffc90022bb749f by task syz-executor.0/6406

CPU: 3 PID: 6406 Comm: syz-executor.0 Not tainted 6.4.0-rc3-syzkaller-00278-g49572d536129 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 find_get_entries+0xa21/0xaf0 mm/filemap.c:2061
 invalidate_inode_pages2_range+0x142/0x10f0 mm/truncate.c:637
 generic_file_direct_write+0x1ca/0x560 mm/filemap.c:3835
 __generic_file_write_iter+0x1a6/0x500 mm/filemap.c:4007
 ntfs_file_write_iter+0x66d/0x1d70 fs/ntfs3/file.c:1055
 call_write_iter include/linux/fs.h:1868 [inline]
 do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:735
 do_iter_write+0x185/0x7e0 fs/read_write.c:860
 vfs_iter_write+0x74/0xa0 fs/read_write.c:901
 iter_file_splice_write+0x743/0xc80 fs/splice.c:795
 do_splice_from fs/splice.c:873 [inline]
 direct_splice_actor+0x114/0x180 fs/splice.c:1039
 splice_direct_to_actor+0x335/0x8a0 fs/splice.c:994
 do_splice_direct+0x1ab/0x280 fs/splice.c:1082
 do_sendfile+0xb19/0x12c0 fs/read_write.c:1254
 __do_sys_sendfile64 fs/read_write.c:1322 [inline]
 __se_sys_sendfile64 fs/read_write.c:1308 [inline]
 __x64_sys_sendfile64+0x1d0/0x210 fs/read_write.c:1308
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f3554c8c169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f35537fe168 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f3554dabf80 RCX: 00007f3554c8c169
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000004
RBP: 00007f3554ce7ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000ef84 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fffe06b927f R14: 00007f35537fe300 R15: 0000000000022000
 </TASK>

The buggy address belongs to stack of task syz-executor.0/6406
 and is located at offset 223 in frame:
 invalidate_inode_pages2_range+0x0/0x10f0 include/linux/page-flags.h:1048

This frame has 3 objects:
 [32, 40) 'index'
 [64, 184) 'indices'
 [224, 352) 'fbatch'

The buggy address belongs to the virtual mapping at
 [ffffc90022bb0000, ffffc90022bb9000) created by:
 kernel_clone+0xeb/0x890 kernel/fork.c:2918

The buggy address belongs to the physical page:
page:ffffea000441a980 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1106a6
memcg:ffff88802b981c82
flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 057ff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff88802b981c82
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 5154, tgid 5154 (syz-executor.0), ts 205557206342, free_ts 204088906708
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
 vm_area_alloc_pages mm/vmalloc.c:3009 [inline]
 __vmalloc_area_node mm/vmalloc.c:3085 [inline]
 __vmalloc_node_range+0xb1c/0x14a0 mm/vmalloc.c:3257
 alloc_thread_stack_node kernel/fork.c:313 [inline]
 dup_task_struct kernel/fork.c:1116 [inline]
 copy_process+0x13bb/0x7600 kernel/fork.c:2333
 kernel_clone+0xeb/0x890 kernel/fork.c:2918
 __do_sys_clone+0xba/0x100 kernel/fork.c:3061
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1302 [inline]
 free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564
 free_unref_page_list+0xe3/0xa70 mm/page_alloc.c:2705
 release_pages+0xcd8/0x1380 mm/swap.c:1042
 __pagevec_release+0x77/0xe0 mm/swap.c:1062
 pagevec_release include/linux/pagevec.h:63 [inline]
 folio_batch_release include/linux/pagevec.h:132 [inline]
 truncate_inode_pages_range+0x2ec/0xf10 mm/truncate.c:372
 kill_bdev block/bdev.c:76 [inline]
 blkdev_flush_mapping+0x152/0x320 block/bdev.c:596
 blkdev_put_whole+0xcb/0xf0 block/bdev.c:627
 blkdev_put+0x220/0x780 block/bdev.c:887
 blkdev_close+0x68/0x80 block/fops.c:507
 __fput+0x27c/0xa90 fs/file_table.c:321
 task_work_run+0x16f/0x270 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffffc90022bb7380: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2
 ffffc90022bb7400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f2
>ffffc90022bb7480: f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
                            ^
 ffffc90022bb7500: 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00 00 00
 ffffc90022bb7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/27 18:39 upstream 49572d536129 cf184559 .config console log report info ci-qemu-upstream KASAN: stack-out-of-bounds Read in find_get_entries
* Struck through repros no longer work on HEAD.