2023-05-31 09:25:45

by syzbot

[permalink] [raw]
Subject: [syzbot] [ntfs?] UBSAN: shift-out-of-bounds in ntfs_iget

Hello,

syzbot found the following issue on:

HEAD commit: afead42fdfca Merge tag 'perf-tools-fixes-for-v6.4-2-2023-0..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15f72e49280000
kernel config: https://syzkaller.appspot.com/x/.config?x=162cf2103e4a7453
dashboard link: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12da9bbd280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=174e8115280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/376b8e00429d/disk-afead42f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ac81705ce028/vmlinux-afead42f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/70c52b82e56a/bzImage-afead42f.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/248748d7ce8e/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

ntfs: (device loop0): ntfs_attr_find(): Inode is corrupt. Run chkdsk.
ntfs: (device loop0): ntfs_read_locked_inode(): Failed to lookup $DATA attribute.
ntfs: (device loop0): ntfs_read_locked_inode(): Failed with error code -5. Marking corrupt inode 0x1 as bad. Run chkdsk.
ntfs: (device loop0): load_system_files(): Failed to load $MFTMirr. Mounting read-only. Run ntfsfix and/or chkdsk.
================================================================================
UBSAN: shift-out-of-bounds in fs/ntfs/inode.c:1080:43
shift exponent 44 is too large for 32-bit type 'unsigned int'
CPU: 0 PID: 5000 Comm: syz-executor185 Not tainted 6.4.0-rc4-syzkaller-00047-gafead42fdfca #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
ubsan_epilogue lib/ubsan.c:217 [inline]
__ubsan_handle_shift_out_of_bounds+0x3c3/0x420 lib/ubsan.c:387
ntfs_read_locked_inode+0x4665/0x49c0 fs/ntfs/inode.c:1080
ntfs_iget+0x113/0x190 fs/ntfs/inode.c:177
load_and_init_upcase fs/ntfs/super.c:1663 [inline]
load_system_files+0x151c/0x4840 fs/ntfs/super.c:1818
ntfs_fill_super+0x19b3/0x2bd0 fs/ntfs/super.c:2900
mount_bdev+0x2d0/0x3f0 fs/super.c:1380
legacy_get_tree+0xef/0x190 fs/fs_context.c:610
vfs_get_tree+0x8c/0x270 fs/super.c:1510
do_new_mount+0x28f/0xae0 fs/namespace.c:3039
do_mount fs/namespace.c:3382 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f183b0f1afa
Code: 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 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:00007ffd7f357638 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f183b0f1afa
RDX: 0000000020000000 RSI: 000000002001ee80 RDI: 00007ffd7f357650
RBP: 00007ffd7f357650 R08: 00007ffd7f357690 R09: 000000000001ee62
R10: 0000000000000010 R11: 0000000000000286 R12: 0000000000000004
R13: 0000555555d422c0 R14: 0000000000000010 R15: 00007ffd7f357690
</TASK>
================================================================================


---
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 [email protected].

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

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup


2024-03-05 20:27:55

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [ntfs3?] UBSAN: shift-out-of-bounds in ntfs_iget

syzbot suspects this issue was fixed by commit:

commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <[email protected]>
Date: Wed Nov 1 17:43:10 2023 +0000

fs: Block writes to mounted block devices

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12be09f2180000
start commit: afead42fdfca Merge tag 'perf-tools-fixes-for-v6.4-2-2023-0..
git tree: upstream
kernel config: https://syzkaller.appspot.com/x/.config?x=162cf2103e4a7453
dashboard link: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12da9bbd280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=174e8115280000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: fs: Block writes to mounted block devices

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

2024-03-06 12:22:08

by Jan Kara

[permalink] [raw]
Subject: Re: [syzbot] [ntfs3?] UBSAN: shift-out-of-bounds in ntfs_iget

On Tue 05-03-24 12:21:02, syzbot wrote:
> syzbot suspects this issue was fixed by commit:
>
> commit 6f861765464f43a71462d52026fbddfc858239a5
> Author: Jan Kara <[email protected]>
> Date: Wed Nov 1 17:43:10 2023 +0000
>
> fs: Block writes to mounted block devices
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12be09f2180000
> start commit: afead42fdfca Merge tag 'perf-tools-fixes-for-v6.4-2-2023-0..
> git tree: upstream
> kernel config: https://syzkaller.appspot.com/x/.config?x=162cf2103e4a7453
> dashboard link: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12da9bbd280000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=174e8115280000
>
> If the result looks correct, please mark the issue as fixed by replying with:

The reproducer is just mounting the fs so I'm not sure what's happening
there. But since there's no working repro and this is ntfs3:

#syz fix: fs: Block writes to mounted block devices

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR