Re: [syzbot] [btrfs?] kernel BUG in btrfs_run_defrag_inodes (2)
From: Julian Sun
Date: Tue Aug 27 2024 - 05:45:14 EST
On Sun, 2024-08-04 at 12:33 -0700, syzbot wrote:
#syz dup: kernel BUG in clear_inode
As mentioned in fix[1], there are two threads simultaneously evicting
the same inode, which may trigger the BUG(inode->i_state & I_CLEAR)
statement both within clear_inode() and iput().
So this report specifically triggered the BUG(inode->i_state & I_CLEAR)
statement in iput(). And I did encounter this issue when I attempted to
reproduce and fix it.
[1]:https://lore.kernel.org/linux-btrfs/20240823130730.658881-1-sunjunchao2870@xxxxxxxxx/
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: e4fc196f5ba3 Merge tag 'for-6.11-rc1-tag' of
> git://git.ker..
> git tree: upstream
> console output:
> https://syzkaller.appspot.com/x/log.txt?x=133acef9980000
> kernel config:
> https://syzkaller.appspot.com/x/.config?x=8b0cca2f3880513d
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=5833b186650f87c5b7c4
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for
> Debian) 2.40
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image:
> https://storage.googleapis.com/syzbot-assets/c4bed4c74b59/disk-e4fc196f.raw.xz
> vmlinux:
> https://storage.googleapis.com/syzbot-assets/f90c5ef25b80/vmlinux-e4fc196f.xz
> kernel image:
> https://storage.googleapis.com/syzbot-assets/3a4dad9a7e8e/bzImage-e4fc196f.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the
> commit:
> Reported-by: syzbot+5833b186650f87c5b7c4@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ------------[ cut here ]------------
> kernel BUG at fs/inode.c:1819!
> Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
> CPU: 1 UID: 0 PID: 10710 Comm: btrfs-cleaner Not tainted 6.11.0-rc1-
> syzkaller-00062-ge4fc196f5ba3 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine,
> BIOS Google 06/27/2024
> RIP: 0010:iput+0x928/0x930 fs/inode.c:1819
> Code: ff e9 a7 fb ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 45 fe
> ff ff 4c 89 f7 e8 33 aa e7 ff e9 38 fe ff ff e8 29 71 80 ff 90 <0f>
> 0b 66 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90
> RSP: 0018:ffffc900041ffc50 EFLAGS: 00010293
> RAX: ffffffff8212f547 RBX: 0000000000000040 RCX: ffff888023d05a00
> RDX: 0000000000000000 RSI: 0000000000000040 RDI: 0000000000000000
> RBP: ffff88805e4f48e0 R08: ffffffff8212ec80 R09: 1ffffffff202f495
> R10: dffffc0000000000 R11: fffffbfff202f496 R12: ffff88805e4f49b0
> R13: ffff88806c102028 R14: 0000000000000005 R15: ffff888068e60350
> FS: 0000000000000000(0000) GS:ffff8880b9300000(0000)
> knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f1c9b094108 CR3: 000000005d542000 CR4: 0000000000350ef0
> Call Trace:
> <TASK>
> __btrfs_run_defrag_inode fs/btrfs/defrag.c:281 [inline]
> btrfs_run_defrag_inodes+0xa80/0xdf0 fs/btrfs/defrag.c:327
> cleaner_kthread+0x28c/0x3d0 fs/btrfs/disk-io.c:1527
> kthread+0x2f2/0x390 kernel/kthread.c:389
> ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
> ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:iput+0x928/0x930 fs/inode.c:1819
> Code: ff e9 a7 fb ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 45 fe
> ff ff 4c 89 f7 e8 33 aa e7 ff e9 38 fe ff ff e8 29 71 80 ff 90 <0f>
> 0b 66 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90
> RSP: 0018:ffffc900041ffc50 EFLAGS: 00010293
> RAX: ffffffff8212f547 RBX: 0000000000000040 RCX: ffff888023d05a00
> RDX: 0000000000000000 RSI: 0000000000000040 RDI: 0000000000000000
> RBP: ffff88805e4f48e0 R08: ffffffff8212ec80 R09: 1ffffffff202f495
> R10: dffffc0000000000 R11: fffffbfff202f496 R12: ffff88805e4f49b0
> R13: ffff88806c102028 R14: 0000000000000005 R15: ffff888068e60350
> FS: 0000000000000000(0000) GS:ffff8880b9300000(0000)
> knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f1c9b094108 CR3: 000000006b99e000 CR4: 0000000000350ef0
>
>
> ---
> 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.
>
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
>
> 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
Thanks,
--
Julian Sun <sunjunchao2870@xxxxxxxxx>