Re: [syzbot] [btrfs?] kernel BUG in btrfs_cancel_balance

From: syzbot
Date: Tue Aug 01 2023 - 23:18:06 EST


syzbot has found a reproducer for the following issue on:

HEAD commit: 5d0c230f1de8 Linux 6.5-rc4
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=13ccaa4da80000
kernel config: https://syzkaller.appspot.com/x/.config?x=1e3d5175079af5a4
dashboard link: https://syzkaller.appspot.com/bug?extid=d6443e1f040e8d616e7b
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1167e711a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16a90161a80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e60219ddf5b3/disk-5d0c230f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d843603af783/vmlinux-5d0c230f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a0a1cdcb2de2/bzImage-5d0c230f.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/6a80485ad7a0/mount_0.gz

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

------------[ cut here ]------------
kernel BUG at fs/btrfs/volumes.c:4642!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 5103 Comm: syz-executor303 Not tainted 6.5.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
RIP: 0010:btrfs_cancel_balance+0x429/0x430 fs/btrfs/volumes.c:4641
Code: e8 1c 31 01 00 4c 89 ef 48 c7 c6 80 fa 4a 8b e8 2d 17 24 07 e9 ef fe ff ff e8 93 ab 25 07 e8 2e f2 f4 fd 0f 0b e8 27 f2 f4 fd <0f> 0b 0f 1f 44 00 00 f3 0f 1e fa 55 48 89 e5 41 57 41 56 41 55 41
RSP: 0018:ffffc90003edfdc0 EFLAGS: 00010293
RAX: ffffffff8396b559 RBX: ffff888072810010 RCX: ffff88801fa88000
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000001
RBP: ffffc90003edfed0 R08: ffff8880728113d3 R09: 1ffff1100e50227a
R10: dffffc0000000000 R11: ffffed100e50227b R12: 1ffff920007dbfc0
R13: ffff888072811468 R14: dffffc0000000000 R15: ffff888072811460
FS: 00007faef2e626c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007faef2a1a000 CR3: 000000001a7bc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
btrfs_ioctl_balance_ctl+0x3f/0x70 fs/btrfs/ioctl.c:3632
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf8/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7faefa2c65f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 81 18 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007faef2e62218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007faefa352618 RCX: 00007faefa2c65f9
RDX: 0000000000000002 RSI: 0000000040049421 RDI: 0000000000000004
RBP: 00007faefa352610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007faefa31f26c
R13: 0030656c69662f2e R14: 7573617461646f6e R15: 61635f7261656c63
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:btrfs_cancel_balance+0x429/0x430 fs/btrfs/volumes.c:4641
Code: e8 1c 31 01 00 4c 89 ef 48 c7 c6 80 fa 4a 8b e8 2d 17 24 07 e9 ef fe ff ff e8 93 ab 25 07 e8 2e f2 f4 fd 0f 0b e8 27 f2 f4 fd <0f> 0b 0f 1f 44 00 00 f3 0f 1e fa 55 48 89 e5 41 57 41 56 41 55 41
RSP: 0018:ffffc90003edfdc0 EFLAGS: 00010293
RAX: ffffffff8396b559 RBX: ffff888072810010 RCX: ffff88801fa88000
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000001
RBP: ffffc90003edfed0 R08: ffff8880728113d3 R09: 1ffff1100e50227a
R10: dffffc0000000000 R11: ffffed100e50227b R12: 1ffff920007dbfc0
R13: ffff888072811468 R14: dffffc0000000000 R15: ffff888072811460
FS: 00007faef2e626c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe38b00e58 CR3: 000000001a7bc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.