[syzbot] kernel BUG in create_pending_snapshot

From: syzbot
Date: Thu Nov 24 2022 - 01:28:52 EST


Hello,

syzbot found the following issue on:

HEAD commit: eb7081409f94 Linux 6.1-rc6
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=14ba30e3880000
kernel config: https://syzkaller.appspot.com/x/.config?x=8d01b6e3197974dd
dashboard link: https://syzkaller.appspot.com/bug?extid=d56e0d33caf7d1a02821
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1562844b880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=137a668d880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/815bacde9ae6/disk-eb708140.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ce54e3220860/vmlinux-eb708140.xz
kernel image: https://storage.googleapis.com/syzbot-assets/52a8ac111c19/bzImage-eb708140.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a9f8cb5ade27/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d56e0d33caf7d1a02821@xxxxxxxxxxxxxxxxxxxxxxxxx

BTRFS info (device loop0): enabling ssd optimizations
------------[ cut here ]------------
kernel BUG at fs/btrfs/transaction.c:1672!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 3638 Comm: syz-executor237 Not tainted 6.1.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:create_pending_snapshot+0x250a/0x2560 fs/btrfs/transaction.c:1672
Code: ff e8 da c7 02 fe 48 c7 c7 60 16 39 8b 44 89 ee 31 c0 e8 c9 65 ca fd 0f 0b b3 01 e9 18 fa ff ff e8 3b 63 0a 07 e8 b6 c7 02 fe <0f> 0b e8 af c7 02 fe 0f 0b e8 a8 c7 02 fe 0f 0b e8 a1 c7 02 fe 48
RSP: 0018:ffffc90003aff6e0 EFLAGS: 00010293
RAX: ffffffff8387d0ba RBX: 00000000fffffff4 RCX: ffff88802722ba80
RDX: 0000000000000000 RSI: 00000000fffffff4 RDI: 0000000000000000
RBP: ffffc90003aff970 R08: ffffffff8387b1f0 R09: fffffbfff1a42e97
R10: fffffbfff1a42e97 R11: 1ffffffff1a42e96 R12: ffff888076ce1780
R13: ffff8880731717d0 R14: ffff888027dea000 R15: ffff8880708b8178
FS: 0000555555bce300(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005626964b1000 CR3: 000000007955e000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
create_pending_snapshots+0x1a8/0x1e0 fs/btrfs/transaction.c:1868
btrfs_commit_transaction+0x13f0/0x3760 fs/btrfs/transaction.c:2323
create_snapshot+0x4aa/0x7e0 fs/btrfs/ioctl.c:833
btrfs_mksubvol+0x62e/0x760 fs/btrfs/ioctl.c:983
btrfs_mksnapshot+0xb5/0xf0 fs/btrfs/ioctl.c:1029
__btrfs_ioctl_snap_create+0x339/0x450 fs/btrfs/ioctl.c:2184
btrfs_ioctl_snap_create+0x134/0x190 fs/btrfs/ioctl.c:2211
btrfs_ioctl+0x15c/0xc10
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7efd25d6d2a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 81 14 00 00 90 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:00007ffe43e29638 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007efd25d6d2a9
RDX: 00000000200000c0 RSI: 0000000050009401 RDI: 0000000000000003
RBP: 0000000000000006 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004
R13: 00007ffe43e29670 R14: 0000000000000003 R15: 00007ffe43e2966a
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:create_pending_snapshot+0x250a/0x2560 fs/btrfs/transaction.c:1672
Code: ff e8 da c7 02 fe 48 c7 c7 60 16 39 8b 44 89 ee 31 c0 e8 c9 65 ca fd 0f 0b b3 01 e9 18 fa ff ff e8 3b 63 0a 07 e8 b6 c7 02 fe <0f> 0b e8 af c7 02 fe 0f 0b e8 a8 c7 02 fe 0f 0b e8 a1 c7 02 fe 48
RSP: 0018:ffffc90003aff6e0 EFLAGS: 00010293
RAX: ffffffff8387d0ba RBX: 00000000fffffff4 RCX: ffff88802722ba80
RDX: 0000000000000000 RSI: 00000000fffffff4 RDI: 0000000000000000
RBP: ffffc90003aff970 R08: ffffffff8387b1f0 R09: fffffbfff1a42e97
R10: fffffbfff1a42e97 R11: 1ffffffff1a42e96 R12: ffff888076ce1780
R13: ffff8880731717d0 R14: ffff888027dea000 R15: ffff8880708b8178
FS: 0000555555bce300(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005626963c87d8 CR3: 000000007955e000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
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@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches