linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [ntfs?] UBSAN: shift-out-of-bounds in ntfs_iget
@ 2023-05-31  9:06 syzbot
  2024-03-05 20:21 ` [syzbot] [ntfs3?] " syzbot
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2023-05-31  9:06 UTC (permalink / raw)
  To: anton, linkinjeon, linux-fsdevel, linux-kernel, linux-ntfs-dev,
	syzkaller-bugs

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: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com

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 syzkaller@googlegroups.com.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [syzbot] [ntfs?] UBSAN: shift-out-of-bounds in ntfs_iget
@ 2023-08-05  4:57 Manas Ghandat
  0 siblings, 0 replies; 4+ messages in thread
From: Manas Ghandat @ 2023-08-05  4:57 UTC (permalink / raw)
  To: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
  Cc: anton, linkinjeon, linux-fsdevel, linux-kernel, linux-ntfs-dev,
	syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

In this bug, the logic at the following line 
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/ntfs/inode.c?id=e8f75c0270d930ef675fee22d74d1a3250e96962#n1067) 
is getting skipped. The `if` condition is not triggered and thus the 
compression issue occurs. I was trying to change the `if` conditions so 
that the check occurs but was getting the following error. Can you 
suggest any way so that the condition gets triggered.

Thanks,
Manas

[-- Attachment #2: trace --]
[-- Type: text/plain, Size: 6056 bytes --]


Booting from ROM..
[    0.000000][    T0] Linux version 6.4.0-01406-ge8f75c0270d9-dirty (manas@manas-VirtualBox) (gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0, GNU ld (GNU Binutils for Ubuntu) 2.39) #8 SMP PREEMPT_DYNAMIC Sat Aug  5 09:08:25 IST 2023
[    0.000000][    T0] Command line: root=/dev/ram rw console=ttyS0 oops=panic panic=1 nokaslr quiet
[    0.000000][    T0] KERNEL supported cpus:
[    0.000000][    T0]   Intel GenuineIntel
[    0.000000][    T0]   AMD AuthenticAMD
[    0.000000][    T0] BIOS-provided physical RAM map:
[    0.000000][    T0] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000][    T0] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000][    T0] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000][    T0] BIOS-e820: [mem 0x0000000000100000-0x000000007ffdffff] usable
[    0.000000][    T0] BIOS-e820: [mem 0x000000007ffe0000-0x000000007fffffff] reserved
[    0.000000][    T0] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000][    T0] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000][    T0] printk: bootconsole [earlyser0] enabled
[    0.000000][    T0] ERROR: earlyprintk= earlyser already used
[    0.000000][    T0] ERROR: earlyprintk= earlyser already used
[    0.000000][    T0] **********************************************************
[    0.000000][    T0] **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
[    0.000000][    T0] **                                                      **
[    0.000000][    T0] ** This system shows unhashed kernel memory addresses   **
[    0.000000][    T0] ** via the console, logs, and other interfaces. This    **
[    0.000000][    T0] ** might reduce the security of your system.            **
[    0.000000][    T0] **                                                      **
[    0.000000][    T0] ** If you see this message and you are not debugging    **
[    0.000000][    T0] ** the kernel, report this immediately to your system   **
[    0.000000][    T0] ** administrator!                                       **
[    0.000000][    T0] **                                                      **
[    0.000000][    T0] **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
[    0.000000][    T0] **********************************************************
[    0.000000][    T0] Malformed early option 'vsyscall'
[    0.648434][    T0] Spectre V2 : Kernel not compiled with retpoline; no mitigation available!
[    2.612422][    T1] kvm_intel: VMX not supported by CPU 0
[    2.615720][    T1] kvm_amd: SVM not supported by CPU 0, can't execute cpuid_8000000a
[    6.084339][    T1] db_root: cannot open: /etc/target
[    8.756930][    T1] nf_conntrack_irc: failed to register helpers
[    8.763863][    T1] nf_conntrack_sane: failed to register helpers
[    8.877704][    T1] nf_conntrack_sip: failed to register helpers
[   10.157682][    T1] exFAT-fs (ram0): invalid fs_name
[   10.158805][    T1] exFAT-fs (ram0): failed to read boot sector
[   10.159977][    T1] exFAT-fs (ram0): failed to recognize exfat type
[   10.166836][    T1] VFS: could not find a valid V7 on ram0.
[   10.170137][    T1] ntfs: (device ram0): ntfs_attr_find(): Inode is corrupt.  Run chkdsk.
[   10.171733][    T1] ntfs: (device ram0): ntfs_read_locked_inode(): Failed to lookup $DATA attribute.
[   10.173439][    T1] ntfs: (device ram0): ntfs_read_locked_inode(): Failed with error code -5.  Marking corrupt inode 0x1 as bad.  Run chkdsk.
[   10.175815][    T1] ntfs: (device ram0): load_system_files(): Failed to load $MFTMirr.  Mounting read-only.  Run ntfsfix and/or chkdsk.
[   10.178684][    T1] ntfs: (device ram0): ntfs_mapping_pairs_decompress(): Missing length entry in mapping pairs array.
[   10.180886][    T1] ntfs: (device ram0): ntfs_mapping_pairs_decompress(): Invalid length in mapping pairs array.
[   10.182804][    T1] ntfs: (device ram0): ntfs_read_block(): Failed to read from inode 0xa, attribute type 0x80, vcn 0x0, offset 0x0 because its location on disk could not be determined even after retrying (error code -5).
[   10.186410][    T1] ntfs: (device ram0): ntfs_mapping_pairs_decompress(): Missing length entry in mapping pairs array.
[   10.188485][    T1] ntfs: (device ram0): ntfs_mapping_pairs_decompress(): Invalid length in mapping pairs array.
[   10.190411][    T1] ntfs: (device ram0): ntfs_read_block(): Failed to read from inode 0xa, attribute type 0x80, vcn 0x0, offset 0x800 because its location on disk could not be determined even after retrying (error code -5).
[   10.313465][    T1] Failed to set sysctl parameter 'max_rcu_stall_to_panic=1': parameter not found
[   10.316218][    T1] Starting init: /sbin/init exists but couldn't execute it (error -5)
[   10.318268][    T1] Starting init: /etc/init exists but couldn't execute it (error -5)
[   10.320047][    T1] Starting init: /bin/init exists but couldn't execute it (error -5)
[   10.321895][    T1] Starting init: /bin/sh exists but couldn't execute it (error -5)
[   10.323410][    T1] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[   10.326181][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.4.0-01406-ge8f75c0270d9-dirty #8
[   10.327781][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-4 04/01/2014
[   10.327781][    T1] Call Trace:
[   10.327781][    T1]  <TASK>
[   10.327781][    T1]  dump_stack_lvl+0xd9/0x1b0
[   10.327781][    T1]  panic+0x6a4/0x750
[   10.327781][    T1]  ? panic_smp_self_stop+0xa0/0xa0
[   10.327781][    T1]  ? putname+0x101/0x140
[   10.327781][    T1]  ? kernel_init+0x265/0x2a0
[   10.327781][    T1]  kernel_init+0x276/0x2a0
[   10.327781][    T1]  ? rest_init+0x2b0/0x2b0
[   10.327781][    T1]  ret_from_fork+0x1f/0x30
[   10.327781][    T1]  </TASK>
[   10.327781][    T1] Kernel Offset: disabled
[   10.327781][    T1] Rebooting in 1 seconds..

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [ntfs3?] UBSAN: shift-out-of-bounds in ntfs_iget
  2023-05-31  9:06 [syzbot] [ntfs?] UBSAN: shift-out-of-bounds in ntfs_iget syzbot
@ 2024-03-05 20:21 ` syzbot
  2024-03-06 12:21   ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2024-03-05 20:21 UTC (permalink / raw)
  To: almaz.alexandrovich, anton, axboe, brauner, ghandatmanas, gregkh,
	jack, linkinjeon, linux-fsdevel, linux-kernel-mentees,
	linux-kernel, linux-ntfs-dev, lkp, llvm, ntfs3, oe-kbuild-all,
	syzkaller-bugs, syzkaller

syzbot suspects this issue was fixed by commit:

commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [ntfs3?] UBSAN: shift-out-of-bounds in ntfs_iget
  2024-03-05 20:21 ` [syzbot] [ntfs3?] " syzbot
@ 2024-03-06 12:21   ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2024-03-06 12:21 UTC (permalink / raw)
  To: syzbot
  Cc: almaz.alexandrovich, anton, axboe, brauner, ghandatmanas, gregkh,
	jack, linkinjeon, linux-fsdevel, linux-kernel-mentees,
	linux-kernel, linux-ntfs-dev, lkp, llvm, ntfs3, oe-kbuild-all,
	syzkaller-bugs, syzkaller

On Tue 05-03-24 12:21:02, syzbot wrote:
> syzbot suspects this issue was fixed by commit:
> 
> commit 6f861765464f43a71462d52026fbddfc858239a5
> Author: Jan Kara <jack@suse.cz>
> 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 <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-06 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31  9:06 [syzbot] [ntfs?] UBSAN: shift-out-of-bounds in ntfs_iget syzbot
2024-03-05 20:21 ` [syzbot] [ntfs3?] " syzbot
2024-03-06 12:21   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2023-08-05  4:57 [syzbot] [ntfs?] " Manas Ghandat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).