[syzbot] [btrfs?] WARNING in btrfs_issue_discard

6 views
Skip to first unread message

syzbot

unread,
Jan 15, 2024, 12:22:20 PMJan 15
to ax...@kernel.dk, c...@fb.com, dst...@suse.com, jo...@toxicpanda.com, kris...@klausen.dk, linux...@vger.kernel.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3e7aeb78ab01 Merge tag 'net-next-6.8' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13f61d33e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=8e557b1c0a57d2c0
dashboard link: https://syzkaller.appspot.com/bug?extid=4a4f1eba14eb5c3417d1
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=16bdfc0be80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=177f3c83e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4c8a9f091067/disk-3e7aeb78.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/8cb663b518a5/vmlinux-3e7aeb78.xz
kernel image: https://storage.googleapis.com/syzbot-assets/bc6d189cfcf3/bzImage-3e7aeb78.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/e37fd964ba01/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/174ce0bdbd5e/mount_4.gz

The issue was bisected to:

commit 2b9ac22b12a266eb4fec246a07b504dd4983b16b
Author: Kristian Klausen <kris...@klausen.dk>
Date: Fri Jun 18 11:51:57 2021 +0000

loop: Fix missing discard support when using LOOP_CONFIGURE

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=111924a5e80000
final oops: https://syzkaller.appspot.com/x/report.txt?x=131924a5e80000
console output: https://syzkaller.appspot.com/x/log.txt?x=151924a5e80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4a4f1e...@syzkaller.appspotmail.com
Fixes: 2b9ac22b12a2 ("loop: Fix missing discard support when using LOOP_CONFIGURE")

------------[ cut here ]------------
WARNING: CPU: 0 PID: 5071 at fs/btrfs/extent-tree.c:1263 btrfs_issue_discard+0x5ba/0x5e0 fs/btrfs/extent-tree.c:1263
Modules linked in:
CPU: 0 PID: 5071 Comm: syz-executor384 Not tainted 6.7.0-syzkaller-04629-g3e7aeb78ab01 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
RIP: 0010:btrfs_issue_discard+0x5ba/0x5e0 fs/btrfs/extent-tree.c:1263
Code: 3c 30 00 74 08 4c 89 e7 e8 23 51 58 fe 4d 01 2c 24 31 ed 89 e8 48 83 c4 28 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 87 be fb fd 90 <0f> 0b 90 4d 01 fd 49 29 dd 49 81 e5 00 fe ff ff 49 89 df e9 74 fa
RSP: 0018:ffffc900043df640 EFLAGS: 00010293
RAX: ffffffff83933039 RBX: 0000000000504200 RCX: ffff888076528000
RDX: 0000000000000000 RSI: 0000000000504018 RDI: 0000000000504200
RBP: ffffc900043df810 R08: ffffffff83932ab8 R09: 1ffff1100516a40e
R10: dffffc0000000000 R11: ffffed100516a40f R12: ffffc900043df760
R13: 000000000018bfe8 R14: ffff88801b14b980 R15: 0000000000504018
FS: 00007f61f8a7e6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f790f99dae0 CR3: 0000000028f87000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
do_discard_extent fs/btrfs/extent-tree.c:1359 [inline]
btrfs_discard_extent+0x605/0xa80 fs/btrfs/extent-tree.c:1410
do_trimming+0x1fd/0x590 fs/btrfs/free-space-cache.c:3673
trim_no_bitmap+0xd60/0x11d0 fs/btrfs/free-space-cache.c:3797
btrfs_trim_block_group+0x14f/0x450 fs/btrfs/free-space-cache.c:4037
btrfs_trim_fs+0x3c7/0x10d0 fs/btrfs/extent-tree.c:6315
btrfs_ioctl_fitrim+0x5ad/0x610 fs/btrfs/ioctl.c:535
btrfs_ioctl+0x12b/0xd40 fs/btrfs/ioctl.c:4583
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:871 [inline]
__se_sys_ioctl+0xf8/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f61f8aef469
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 1f 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:00007f61f8a7e168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000040 RCX: 00007f61f8aef469
RDX: 0000000020000080 RSI: 00000000c0185879 RDI: 0000000000000005
RBP: 00007f61f8b95710 R08: 00007f61f8b95718 R09: 00007f61f8b95718
R10: 00007f61f8a7e6c0 R11: 0000000000000246 R12: 00007f61f8b9571c
R13: 000000000000006e R14: 00007ffd9ed8dbf0 R15: 00007ffd9ed8dcd8
</TASK>


---
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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

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.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

David Sterba

unread,
Jan 15, 2024, 2:16:12 PMJan 15
to syzbot, ax...@kernel.dk, c...@fb.com, dst...@suse.com, jo...@toxicpanda.com, kris...@klausen.dk, linux...@vger.kernel.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Mon, Jan 15, 2024 at 09:22:19AM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 3e7aeb78ab01 Merge tag 'net-next-6.8' of git://git.kernel...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=13f61d33e80000
> kernel config: https://syzkaller.appspot.com/x/.config?x=8e557b1c0a57d2c0
> dashboard link: https://syzkaller.appspot.com/bug?extid=4a4f1eba14eb5c3417d1
> 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=16bdfc0be80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=177f3c83e80000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/4c8a9f091067/disk-3e7aeb78.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/8cb663b518a5/vmlinux-3e7aeb78.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/bc6d189cfcf3/bzImage-3e7aeb78.xz
> mounted in repro #1: https://storage.googleapis.com/syzbot-assets/e37fd964ba01/mount_0.gz
> mounted in repro #2: https://storage.googleapis.com/syzbot-assets/174ce0bdbd5e/mount_4.gz
>
> The issue was bisected to:
>
> commit 2b9ac22b12a266eb4fec246a07b504dd4983b16b
> Author: Kristian Klausen <kris...@klausen.dk>
> Date: Fri Jun 18 11:51:57 2021 +0000
>
> loop: Fix missing discard support when using LOOP_CONFIGURE

This only adds proper discard support to loop device so it makes the
problem visible.

> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=111924a5e80000
> final oops: https://syzkaller.appspot.com/x/report.txt?x=131924a5e80000
> console output: https://syzkaller.appspot.com/x/log.txt?x=151924a5e80000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+4a4f1e...@syzkaller.appspotmail.com
> Fixes: 2b9ac22b12a2 ("loop: Fix missing discard support when using LOOP_CONFIGURE")
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 5071 at fs/btrfs/extent-tree.c:1263 btrfs_issue_discard+0x5ba/0x5e0 fs/btrfs/extent-tree.c:1263

1256 static int btrfs_issue_discard(struct block_device *bdev, u64 start, u64 len,
1257 u64 *discarded_bytes)
1258 {
1259 int j, ret = 0;
1260 u64 bytes_left, end;
1261 u64 aligned_start = ALIGN(start, 1 << SECTOR_SHIFT);
1262
1263 if (WARN_ON(start != aligned_start)) {
^^^^

1264 len -= aligned_start - start;
1265 len = round_down(len, 1 << SECTOR_SHIFT);
1266 start = aligned_start;
1267 }

The alignment check was added in 4d89d377bbb0 ("btrfs: btrfs_issue_discard
ensure offset/length are aligned to sector boundaries"), with the
WARN_ON. It seems that syzbot is testing unaligned discard requests,
which is probably ok but the warning is excessive as there's a fallback.
Reply all
Reply to author
Forward
0 new messages