[ntfs3?] KASAN: stack-out-of-bounds Read in ntfs_set_inode

1 view
Skip to first unread message

syzbot

unread,
Mar 20, 2023, 1:12:58 AM3/20/23
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9c1bec9c0b08 Merge tag 'linux-kselftest-fixes-6.3-rc3' of ..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=145d9d42c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=6c84f77790aba2eb
dashboard link: https://syzkaller.appspot.com/bug?extid=0062ff5e0332724a1e8e
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: i386
CC: [almaz.ale...@paragon-software.com linux-...@vger.kernel.org linux-...@vger.kernel.org ll...@lists.linux.dev nat...@kernel.org ndesau...@google.com nt...@lists.linux.dev tr...@redhat.com]

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+0062ff...@syzkaller.appspotmail.com

loop1: detected capacity change from 0 to 4096
ntfs3: loop1: Different NTFS' sector size (2048) and media sector size (512)
==================================================================
BUG: KASAN: stack-out-of-bounds in ino_get fs/ntfs3/ntfs.h:193 [inline]
BUG: KASAN: stack-out-of-bounds in ntfs_set_inode+0x65/0x70 fs/ntfs3/inode.c:502
Read of size 4 at addr ffffc90027b67caf by task syz-executor.1/11551

CPU: 1 PID: 11551 Comm: syz-executor.1 Not tainted 6.3.0-rc2-syzkaller-00050-g9c1bec9c0b08 #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:319
print_report mm/kasan/report.c:430 [inline]
kasan_report+0x11c/0x130 mm/kasan/report.c:536
ino_get fs/ntfs3/ntfs.h:193 [inline]
ntfs_set_inode+0x65/0x70 fs/ntfs3/inode.c:502
inode_insert5+0x125/0x660 fs/inode.c:1188
iget5_locked fs/inode.c:1246 [inline]
iget5_locked+0x225/0x2c0 fs/inode.c:1235
ntfs_iget5+0xd2/0x3310 fs/ntfs3/inode.c:511
ntfs_fill_super+0x3138/0x3ab0 fs/ntfs3/super.c:1244
get_tree_bdev+0x444/0x760 fs/super.c:1294
vfs_get_tree+0x8d/0x350 fs/super.c:1501
do_new_mount fs/namespace.c:3042 [inline]
path_mount+0x1342/0x1e40 fs/namespace.c:3372
do_mount fs/namespace.c:3385 [inline]
__do_sys_mount fs/namespace.c:3594 [inline]
__se_sys_mount fs/namespace.c:3571 [inline]
__ia32_sys_mount+0x282/0x300 fs/namespace.c:3571
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7fae579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f7fa9410 EFLAGS: 00000296 ORIG_RAX: 0000000000000015
RAX: ffffffffffffffda RBX: 00000000f7fa9480 RCX: 0000000020000040
RDX: 0000000020000180 RSI: 0000000000000080 RDI: 00000000f7fa94c0
RBP: 00000000f7fa94c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>

The buggy address belongs to stack of task syz-executor.1/11551
and is located at offset 127 in frame:
ntfs_fill_super+0x0/0x3ab0 fs/ntfs3/super.c:473

This frame has 5 objects:
[48, 52) 'vcn'
[64, 68) 'lcn'
[80, 84) 'len'
[96, 104) 'tt'
[128, 136) 'ref'

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

The buggy address belongs to the physical page:
page:ffffea000122c900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x48b24
memcg:ffff888071369e02
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
raw: 04fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff888071369e02
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 10785, tgid 10785 (kworker/u8:4), ts 1938473629749, free_ts 1866743037105
prep_new_page mm/page_alloc.c:2552 [inline]
get_page_from_freelist+0x1190/0x2e20 mm/page_alloc.c:4325
__alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:5591
alloc_pages+0x1aa/0x270 mm/mempolicy.c:2283
vm_area_alloc_pages mm/vmalloc.c:2943 [inline]
__vmalloc_area_node mm/vmalloc.c:3011 [inline]
__vmalloc_node_range+0xb30/0x1300 mm/vmalloc.c:3181
alloc_thread_stack_node kernel/fork.c:311 [inline]
dup_task_struct kernel/fork.c:984 [inline]
copy_process+0x1320/0x7590 kernel/fork.c:2100
kernel_clone+0xeb/0x890 kernel/fork.c:2684
user_mode_thread+0xb1/0xf0 kernel/fork.c:2760
call_usermodehelper_exec_sync kernel/umh.c:133 [inline]
call_usermodehelper_exec_work+0x6d/0x180 kernel/umh.c:164
process_one_work+0x991/0x15c0 kernel/workqueue.c:2390
worker_thread+0x669/0x1090 kernel/workqueue.c:2537
kthread+0x2e8/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1453 [inline]
free_pcp_prepare+0x5d5/0xa50 mm/page_alloc.c:1503
free_unref_page_prepare mm/page_alloc.c:3387 [inline]
free_unref_page+0x1d/0x490 mm/page_alloc.c:3482
mon_free_buff drivers/usb/mon/mon_bin.c:1352 [inline]
mon_bin_release+0x160/0x240 drivers/usb/mon/mon_bin.c:792
__fput+0x27c/0xa90 fs/file_table.c:321
task_work_run+0x16f/0x270 kernel/task_work.c:179
get_signal+0x1c7/0x25b0 kernel/signal.c:2635
arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:306
exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
__do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82

Memory state around the buggy address:
ffffc90027b67b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90027b67c00: 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1 04 f2 04 f2
>ffffc90027b67c80: 04 f2 00 f2 f2 f2 00 f3 f3 f3 00 00 00 00 00 00
^
ffffc90027b67d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90027b67d80: 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1 04
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 10 06 adc %al,(%rsi)
2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi
6: 10 07 adc %al,(%rdi)
8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi
c: 10 08 adc %cl,(%rax)
e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi
1e: 00 51 52 add %dl,0x52(%rcx)
21: 55 push %rbp
22: 89 e5 mov %esp,%ebp
24: 0f 34 sysenter
26: cd 80 int $0x80
* 28: 5d pop %rbp <-- trapping instruction
29: 5a pop %rdx
2a: 59 pop %rcx
2b: c3 retq
2c: 90 nop
2d: 90 nop
2e: 90 nop
2f: 90 nop
30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi
37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Apr 18, 2023, 4:27:32 PM4/18/23
to syzkaller-upst...@googlegroups.com
Sending this report to the next reporting stage.
Reply all
Reply to author
Forward
0 new messages