2023-01-24 16:22:22

by Sanan Hasanov

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

Good day, dear maintainers,

We found a bug using a modified kernel configuration file used by syzbot.

We enhanced the coverage of the configuration file using our tool, klocalizer.

Kernel Branch:?6.2.0-rc4-next-20230120
Kernel config:?https://drive.google.com/file/d/1E1xcz6pp-gsnaqVzG9EgeAJ7mtO-GS3M/view?usp=sharing
Reproducer:?https://drive.google.com/file/d/1y5zAf7Q0VGFeGQYoTzjBU2b_UZZeUD48/view?usp=sharing

Thank you!

Best regards,
Sanan Hasanov

------------[ cut here ]------------
kernel BUG at fs/ntfs/file.c:493!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 21551 Comm: syz-executor.0 Not tainted 6.2.0-rc4-next-20230120 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:__ntfs_grab_cache_pages fs/ntfs/file.c:493 [inline]
RIP: 0010:ntfs_perform_write.isra.0+0x16d6/0x3070 fs/ntfs/file.c:1833
Code: 00 00 48 8b 44 24 40 41 89 d9 48 c7 c2 60 c1 21 8a 48 c7 c7 20 c7 21 8a 48 8b 30 e8 14 2f ff ff e9 5c ef ff ff e8 3a 7a d3 fe <0f> 0b e8 33 7a d3 fe 48 8b 5c 24 48 31 ff 48 89 de e8 f4 76 d3 fe
RSP: 0018:ffffc9000b16fa78 EFLAGS: 00010216

RAX: 00000000000300c6 RBX: 0000000000000000 RCX: ffffc9000f349000
RDX: 0000000000040000 RSI: ffffffff82aa6d46 RDI: 0000000000000005
RBP: ffffc9000b16fbb8 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: ffffea0001b55a00
R13: ffffea0001b55a00 R14: 0000000000000000 R15: dffffc0000000000
FS: ?00007feedead7700(0000) GS:ffff888119a00000(0000) knlGS:0000000000000000
CS: ?0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6d639e0000 CR3: 000000001260b000 CR4: 0000000000350ef0
Call Trace:
?<TASK>
?ntfs_file_write_iter+0x5c0/0x1df0 fs/ntfs/file.c:1917
?call_write_iter include/linux/fs.h:1851 [inline]
?new_sync_write fs/read_write.c:491 [inline]
?vfs_write+0x9f3/0xe20 fs/read_write.c:584
?ksys_write+0x12b/0x250 fs/read_write.c:637
?do_syscall_x64 arch/x86/entry/common.c:50 [inline]
?do_syscall_64+0x39/0x80 arch/x86/entry/common.c:80
?entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7feedd88edcd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007feedead6bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007feedd9bbf80 RCX: 00007feedd88edcd
RDX: 0000000000000001 RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00007feedead6c50 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000a
R13: 00007ffc85b8592f R14: 00007ffc85b85ad0 R15: 00007feedead6d80
?</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__ntfs_grab_cache_pages fs/ntfs/file.c:493 [inline]
RIP: 0010:ntfs_perform_write.isra.0+0x16d6/0x3070 fs/ntfs/file.c:1833
Code: 00 00 48 8b 44 24 40 41 89 d9 48 c7 c2 60 c1 21 8a 48 c7 c7 20 c7 21 8a 48 8b 30 e8 14 2f ff ff e9 5c ef ff ff e8 3a 7a d3 fe <0f> 0b e8 33 7a d3 fe 48 8b 5c 24 48 31 ff 48 89 de e8 f4 76 d3 fe
RSP: 0018:ffffc9000b16fa78 EFLAGS: 00010216
RAX: 00000000000300c6 RBX: 0000000000000000 RCX: ffffc9000f349000
RDX: 0000000000040000 RSI: ffffffff82aa6d46 RDI: 0000000000000005
RBP: ffffc9000b16fbb8 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: ffffea0001b55a00
R13: ffffea0001b55a00 R14: 0000000000000000 R15: dffffc0000000000
FS: ?00007feedead7700(0000) GS:ffff888119a00000(0000) knlGS:0000000000000000
CS: ?0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6d639e0000 CR3: 000000001260b000 CR4: 0000000000350ef0