syzbot


KASAN: stack-out-of-bounds Write in ntfs_evict_inode

Status: upstream: reported on 2024/12/27 12:31
Reported-by: syzbot+0d61c6128f321b9e6952@syzkaller.appspotmail.com
First crash: 39d, last: 39d

Sample crash report:
loop0: detected capacity change from 0 to 4096
ntfs3: loop0: Different NTFS' sector size (1024) and media sector size (512)
==================================================================
BUG: KASAN: stack-out-of-bounds in truncate_inode_pages_range+0xc6/0x1340 mm/truncate.c:335
Write of size 120 at addr ffffc900037af860 by task syz.0.289/5556

CPU: 1 PID: 5556 Comm: syz.0.289 Tainted: G        W          6.1.121-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:427
 kasan_report+0x136/0x160 mm/kasan/report.c:531
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 memset+0x1f/0x40 mm/kasan/shadow.c:44
 truncate_inode_pages_range+0xc6/0x1340 mm/truncate.c:335
 ntfs_evict_inode+0x18/0xb0 fs/ntfs3/inode.c:1776
 evict+0x529/0x930 fs/inode.c:705
 ntfs_fill_super+0x3c01/0x4410 fs/ntfs3/super.c:1190
 get_tree_bdev+0x3fe/0x620 fs/super.c:1366
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3056
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fede7d874ca
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fede8bf2e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fede8bf2ef0 RCX: 00007fede7d874ca
RDX: 0000000020000040 RSI: 0000000020000980 RDI: 00007fede8bf2eb0
RBP: 0000000020000040 R08: 00007fede8bf2ef0 R09: 0000000000800000
R10: 0000000000800000 R11: 0000000000000246 R12: 0000000020000980
R13: 00007fede8bf2eb0 R14: 000000000001f837 R15: 0000000020000640
 </TASK>

The buggy address belongs to stack of task syz.0.289/5556
 and is located at offset 192 in frame:
 truncate_inode_pages_range+0x0/0x1340

This frame has 2 objects:
 [32, 160) 'fbatch'
 [192, 312) 'indices'

The buggy address belongs to the virtual mapping at
 [ffffc900037a8000, ffffc900037b1000) created by:
 copy_process+0x637/0x4060 kernel/fork.c:2096

The buggy address belongs to the physical page:
page:ffffea0000c58a40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x31629
memcg:ffff88801d71da82
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff88801d71da82
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 5554, tgid 5554 (syz.0.289), ts 212767574449, free_ts 212748797218
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5605
 vm_area_alloc_pages mm/vmalloc.c:2992 [inline]
 __vmalloc_area_node mm/vmalloc.c:3061 [inline]
 __vmalloc_node_range+0x9b3/0x14b0 mm/vmalloc.c:3233
 alloc_thread_stack_node kernel/fork.c:312 [inline]
 dup_task_struct+0x3e5/0x6d0 kernel/fork.c:989
 copy_process+0x637/0x4060 kernel/fork.c:2096
 kernel_clone+0x222/0x920 kernel/fork.c:2681
 __do_sys_clone3 kernel/fork.c:2980 [inline]
 __se_sys_clone3+0x373/0x410 kernel/fork.c:2964
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3525
 release_pages+0x24c4/0x27a0 mm/swap.c:1035
 __pagevec_release+0x80/0xf0 mm/swap.c:1055
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 invalidate_mapping_pagevec+0x621/0x730 mm/truncate.c:542
 ntfs_loadlog_and_replay+0x338/0x530 fs/ntfs3/fsntfs.c:305
 ntfs_fill_super+0x2425/0x4410 fs/ntfs3/super.c:1018
 get_tree_bdev+0x3fe/0x620 fs/super.c:1366
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3056
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffffc900037af700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc900037af780: 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00
>ffffc900037af800: 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 f3
                                                                ^
 ffffc900037af880: 00 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 f3
 ffffc900037af900: 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
2024/12/27 12:30 linux-6.1.y 29f02ec58a94 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: stack-out-of-bounds Write in ntfs_evict_inode
* Struck through repros no longer work on HEAD.