2022-07-21 02:38:41

by Dipanjan Das

[permalink] [raw]
Subject: kernel BUG in ntfs_read_folio

Hi,

We would like to report the following bug which has been found by our
modified version of syzkaller.

======================================================
description: kernel BUG in ntfs_read_folio
affected file: fs/ntfs/aops.c
kernel version: 5.19-rc6
kernel commit: 32346491ddf24599decca06190ebca03ff9de7f8
git tree: upstream
kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=cd73026ceaed1402
crash reproducer: attached
======================================================
Crash log:
======================================================
kernel BUG at fs/ntfs/aops.c:186!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 6070 Comm: syz-executor.3 Tainted: G OE
5.19.0-rc6-g2eae0556bb9d #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:ntfs_read_block fs/ntfs/aops.c:186 [inline]
RIP: 0010:ntfs_read_folio+0x306a/0x4250 fs/ntfs/aops.c:436
Code: 00 48 8b 44 24 18 31 ff 48 8b 98 30 fd ff ff 48 c1 eb 03 83 e3
01 89 de e8 23 cd d8 fe 84 db 0f 85 60 e8 ff ff e8 f6 cb d8 fe <0f> 0b
e8 ef cb d8 fe 48 c7 c6 a0 f5 00 8a 4c 89 ff e8 a0 87 0e ff
RSP: 0018:ffffc9001de2f848 EFLAGS: 00010212
RAX: 0000000000005c9f RBX: 0000000000000000 RCX: 0000000000040000
RDX: ffffc90002a91000 RSI: ffff888038f40000 RDI: 0000000000000002
RBP: ffff8880195f4250 R08: ffffffff82a204ca R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: ffff8880195f4250
R13: ffffea0002024220 R14: fffff94000404841 R15: ffffea0002024200
FS: 00007f223e52d700(0000) GS:ffff888135c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe2f01b0000 CR3: 000000008d587000 CR4: 0000000000150ee0
Call Trace:
<TASK>
do_read_cache_folio+0x213/0x6c0 mm/filemap.c:3524
do_read_cache_page mm/filemap.c:3602 [inline]
read_cache_page+0x62/0x2b0 mm/filemap.c:3611
read_mapping_page include/linux/pagemap.h:759 [inline]
ntfs_map_page fs/ntfs/aops.h:75 [inline]
map_mft_record_page fs/ntfs/mft.c:73 [inline]
map_mft_record+0x1db/0x10c0 fs/ntfs/mft.c:156
ntfs_read_locked_inode+0x19c/0x5ab0 fs/ntfs/inode.c:550
ntfs_read_inode_mount+0xd72/0x2480 fs/ntfs/inode.c:2091
ntfs_fill_super+0x16ce/0x3520 fs/ntfs/super.c:2854
mount_bdev+0x34d/0x410 fs/super.c:1367
legacy_get_tree+0x105/0x220 fs/fs_context.c:610
vfs_get_tree+0x89/0x2f0 fs/super.c:1497
do_new_mount fs/namespace.c:3040 [inline]
path_mount+0x1228/0x1cb0 fs/namespace.c:3370
do_mount+0xf3/0x110 fs/namespace.c:3383
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__x64_sys_mount+0x18f/0x230 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f223d48fe8e
Code: 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f
84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 a5 00 00 00 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:00007f223e52c9f8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00007f223d48fe8e
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007f223e52ca50
RBP: 00007f223e52ca90 R08: 00007f223e52ca90 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 00007f223e52ca50 R15: 0000000020086400
</TASK>
Modules linked in: uio_ivshmem(OE) uio(E)
---[ end trace 0000000000000000 ]---
RIP: 0010:ntfs_read_block fs/ntfs/aops.c:186 [inline]
RIP: 0010:ntfs_read_folio+0x306a/0x4250 fs/ntfs/aops.c:436
Code: 00 48 8b 44 24 18 31 ff 48 8b 98 30 fd ff ff 48 c1 eb 03 83 e3
01 89 de e8 23 cd d8 fe 84 db 0f 85 60 e8 ff ff e8 f6 cb d8 fe <0f> 0b
e8 ef cb d8 fe 48 c7 c6 a0 f5 00 8a 4c 89 ff e8 a0 87 0e ff
RSP: 0018:ffffc9001de2f848 EFLAGS: 00010212
RAX: 0000000000005c9f RBX: 0000000000000000 RCX: 0000000000040000
RDX: ffffc90002a91000 RSI: ffff888038f40000 RDI: 0000000000000002
RBP: ffff8880195f4250 R08: ffffffff82a204ca R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: ffff8880195f4250
R13: ffffea0002024220 R14: fffff94000404841 R15: ffffea0002024200
FS: 00007f223e52d700(0000) GS:ffff888063c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f67d6e60c30 CR3: 000000008d587000 CR4: 0000000000150ef0

--
Thanks and Regards,

Dipanjan


Attachments:
repro.c (11.11 kB)
repro.syz (2.57 kB)
Download all attachments