Re: [syzbot] kernel BUG in mpage_prepare_extent_to_map

syzbot
2021-06-12T21:55:41Z

syzbot has found a reproducer for the following issue on:

HEAD commit: ad347abe Merge tag 'trace-v5.13-rc5-2' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16223e3fd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=30f476588412c065
dashboard link: https://syzkaller.appspot.com/bug?extid=99043e2052d9c50c81fc
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1204231fd00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1324e4d0300000

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

loop0: detected capacity change from 0 to 512
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue. Quota mode: none.
------------[ cut here ]------------
kernel BUG at fs/ext4/inode.c:2704!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8394 Comm: syz-executor475 Not tainted 5.13.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:ext4_writepages+0x244d/0x3b70 fs/ext4/inode.c:2704
Code: e1 be 00 10 00 00 4c 89 ef 48 d3 ee ba 01 00 00 00 e8 57 23 fe ff 83 c0 01 89 84 24 bc 00 00 00 e9 2d e2 ff ff e8 73 d5 66 ff <0f> 0b e8 6c d5 66 ff 44 0f b6 a4 24 db 00 00 00 89 5c 24 08 e9 a7
RSP: 0018:ffffc900019ff580 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
RDX: ffff88801cad54c0 RSI: ffffffff820e071d RDI: 0000000000000003
RBP: ffff888035bc5a08 R08: 0000000000000000 R09: ffff888035bc5a0f
R10: ffffffff820dfbf3 R11: 0000000000000000 R12: 0000000000000001
R13: ffff888035bc5cf0 R14: ffffc900019ffa08 R15: ffff88801d9ea000
FS: 0000000000865300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff50003d188 CR3: 000000002e66c000 CR4: 0000000000350ee0
Call Trace:
do_writepages+0xec/0x290 mm/page-writeback.c:2352
__filemap_fdatawrite_range+0x2a5/0x390 mm/filemap.c:413
file_write_and_wait_range+0xb2/0x120 mm/filemap.c:792
ext4_sync_file+0x21f/0xfd0 fs/ext4/fsync.c:151
vfs_fsync_range+0x13a/0x220 fs/sync.c:200
generic_write_sync include/linux/fs.h:2982 [inline]
ext4_buffered_write_iter+0x36a/0x4d0 fs/ext4/file.c:277
ext4_file_write_iter+0x423/0x14e0 fs/ext4/file.c:680
call_write_iter include/linux/fs.h:2114 [inline]
new_sync_write+0x426/0x650 fs/read_write.c:518
vfs_write+0x796/0xa30 fs/read_write.c:605
ksys_write+0x12d/0x250 fs/read_write.c:658
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x443dc9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffef54952a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 0000000000443dc9
RDX: 0000000000000082 RSI: 0000000020000180 RDI: 0000000000000004
RBP: 0000000000403660 R08: 00000000004004a0 R09: 00000000004004a0
R10: 00000000004004a0 R11: 0000000000000246 R12: 00000000004036f0
R13: 0000000000000000 R14: 00000000004b2018 R15: 00000000004004a0
Modules linked in:
---[ end trace e0abbb4b21cfac7f ]---
RIP: 0010:ext4_writepages+0x244d/0x3b70 fs/ext4/inode.c:2704
Code: e1 be 00 10 00 00 4c 89 ef 48 d3 ee ba 01 00 00 00 e8 57 23 fe ff 83 c0 01 89 84 24 bc 00 00 00 e9 2d e2 ff ff e8 73 d5 66 ff <0f> 0b e8 6c d5 66 ff 44 0f b6 a4 24 db 00 00 00 89 5c 24 08 e9 a7
RSP: 0018:ffffc900019ff580 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
RDX: ffff88801cad54c0 RSI: ffffffff820e071d RDI: 0000000000000003
RBP: ffff888035bc5a08 R08: 0000000000000000 R09: ffff888035bc5a0f
R10: ffffffff820dfbf3 R11: 0000000000000000 R12: 0000000000000001
R13: ffff888035bc5cf0 R14: ffffc900019ffa08 R15: ffff88801d9ea000
FS: 0000000000865300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f205933e000 CR3: 000000002e66c000 CR4: 0000000000350ef0