Re: [syzbot] [btrfs?] kernel BUG in __extent_writepage_io (2)

syzbot
2024-08-29T05:57:03Z

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
kernel BUG in btrfs_add_extent_mapping

em: ffff888066d637e0, blockstart: 18446744073709551613, em refs: 1, add_extent_mapping
em: ffff888066d637e0, blockstart: 18446744073709551613, mblockstart: 18446744073709551613, try_merge_map
setuped, em: ffff888066d637e0, blockstart: 18446744073709551613, em refs: 2, add_extent_mapping
assertion failed: extent_map_block_start(em) != EXTENT_MAP_HOLE, in fs/btrfs/extent_map.c:752
------------[ cut here ]------------
kernel BUG at fs/btrfs/extent_map.c:752!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 6365 Comm: syz.1.20 Not tainted 6.11.0-rc5-syzkaller-00081-gd5d547aa7b51-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:btrfs_add_extent_mapping+0x715/0x790 fs/btrfs/extent_map.c:752
Code: f9 07 90 0f 0b e8 8b e6 e1 fd 48 c7 c7 20 5b 2c 8c 48 c7 c6 20 5c 2c 8c 48 c7 c2 a0 59 2c 8c b9 f0 02 00 00 e8 2c c5 f9 07 90 <0f> 0b e8 64 e6 e1 fd 49 be 00 00 00 00 00 fc ff df e9 6a fb ff ff
RSP: 0018:ffffc900032b7160 EFLAGS: 00010246
RAX: 000000000000005d RBX: dffffc0000000000 RCX: 10a2bc291a71c100
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 1ffff1100cdac701 R08: ffffffff817400cc R09: fffffbfff1cba0e0
R10: dffffc0000000000 R11: fffffbfff1cba0e0 R12: ffff888066d63808
R13: ffff888066d637e0 R14: 0000000000000000 R15: fffffffffffffffd
FS: 00007f3abd3676c0(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fffd35749c8 CR3: 0000000074d68000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
btrfs_get_extent+0x124b/0x1d30 fs/btrfs/inode.c:6962
btrfs_cont_expand+0x28f/0xcd0 fs/btrfs/inode.c:4923
btrfs_write_check+0x440/0x590 fs/btrfs/file.c:1181
btrfs_buffered_write+0x288/0x1360 fs/btrfs/file.c:1221
btrfs_direct_write+0x531/0xb40 fs/btrfs/direct-io.c:942
btrfs_do_write_iter+0x2a1/0x760 fs/btrfs/file.c:1505
do_iter_readv_writev+0x60a/0x890
vfs_writev+0x37c/0xbb0 fs/read_write.c:971
do_pwritev fs/read_write.c:1072 [inline]
__do_sys_pwritev2 fs/read_write.c:1131 [inline]
__se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f3abc579e79
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f3abd367038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f3abc716058 RCX: 00007f3abc579e79
RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000004
RBP: 00007f3abc5e793e R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f3abc716058 R15: 00007ffe16a6f238
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:btrfs_add_extent_mapping+0x715/0x790 fs/btrfs/extent_map.c:752
Code: f9 07 90 0f 0b e8 8b e6 e1 fd 48 c7 c7 20 5b 2c 8c 48 c7 c6 20 5c 2c 8c 48 c7 c2 a0 59 2c 8c b9 f0 02 00 00 e8 2c c5 f9 07 90 <0f> 0b e8 64 e6 e1 fd 49 be 00 00 00 00 00 fc ff df e9 6a fb ff ff
RSP: 0018:ffffc900032b7160 EFLAGS: 00010246
RAX: 000000000000005d RBX: dffffc0000000000 RCX: 10a2bc291a71c100
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 1ffff1100cdac701 R08: ffffffff817400cc R09: fffffbfff1cba0e0
R10: dffffc0000000000 R11: fffffbfff1cba0e0 R12: ffff888066d63808
R13: ffff888066d637e0 R14: 0000000000000000 R15: fffffffffffffffd
FS: 00007f3abd3676c0(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fffd35749c8 CR3: 0000000074d68000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Tested on:

commit: d5d547aa Merge tag 'random-6.11-rc6-for-linus' of git:..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1266cceb980000
kernel config: https://syzkaller.appspot.com/x/.config?x=a0455552d0b27491
dashboard link: https://syzkaller.appspot.com/bug?extid=ba3c0273042a898c230e
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11df82eb980000