[syzbot] general protection fault in btrfs_stop_all_workers

16 views
Skip to first unread message

syzbot

unread,
Apr 27, 2022, 1:42:22 PM4/27/22
to c...@fb.com, dst...@suse.com, h...@lst.de, jo...@toxicpanda.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, w...@suse.com
Hello,

syzbot found the following issue on:

HEAD commit: 088fb7eff349 Add linux-next specific files for 20220426
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=141fd6b4f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=f49713d2574602b3
dashboard link: https://syzkaller.appspot.com/bug?extid=a2c720e0f056114ea7c6
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1000ce34f00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13edbbfcf00000

The issue was bisected to:

commit 9d7bd4c387c1b4776832cf8c895ab934efaa2f08
Author: Christoph Hellwig <h...@lst.de>
Date: Mon Apr 18 04:43:11 2022 +0000

btrfs: use a normal workqueue for rmw_workers

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13f36f78f00000
final oops: https://syzkaller.appspot.com/x/report.txt?x=100b6f78f00000
console output: https://syzkaller.appspot.com/x/log.txt?x=17f36f78f00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a2c720...@syzkaller.appspotmail.com
Fixes: 9d7bd4c387c1 ("btrfs: use a normal workqueue for rmw_workers")

general protection fault, probably for non-canonical address 0xdffffc0000000023: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f]
CPU: 0 PID: 3596 Comm: syz-executor105 Not tainted 5.18.0-rc4-next-20220426-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:workqueue_sysfs_unregister kernel/workqueue.c:5796 [inline]
RIP: 0010:destroy_workqueue+0x2e/0x800 kernel/workqueue.c:4430
Code: 49 89 fe 41 55 41 54 55 53 48 83 ec 08 e8 2a fe 2b 00 49 8d be 18 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 37 07 00 00 49 8b 9e 18 01 00 00 48 85 db 74 19
RSP: 0018:ffffc90002f6f818 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: ffff8880248b4000 RCX: 0000000000000000
RDX: 0000000000000023 RSI: ffffffff814e4606 RDI: 0000000000000118
RBP: ffff8880248b4000 R08: 0000000000000000 R09: ffffffff9007194f
R10: 0000000000000001 R11: 0000000000000001 R12: 00000000fffffff4
R13: 0000000000001000 R14: 0000000000000000 R15: ffff88801e866000
FS: 00007f4c1f989700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4c1fa2ff78 CR3: 000000002490a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
btrfs_stop_all_workers+0x14c/0x2fe fs/btrfs/disk-io.c:2286
open_ctree+0x481f/0x493b fs/btrfs/disk-io.c:3959
btrfs_fill_super fs/btrfs/super.c:1430 [inline]
btrfs_mount_root.cold+0x15/0x162 fs/btrfs/super.c:1796
legacy_get_tree+0x105/0x220 fs/fs_context.c:610
vfs_get_tree+0x89/0x2f0 fs/super.c:1497
fc_mount fs/namespace.c:1043 [inline]
vfs_kern_mount.part.0+0xd3/0x170 fs/namespace.c:1073
vfs_kern_mount+0x3c/0x60 fs/namespace.c:1060
btrfs_mount+0x234/0xa60 fs/btrfs/super.c:1856
legacy_get_tree+0x105/0x220 fs/fs_context.c:610
vfs_get_tree+0x89/0x2f0 fs/super.c:1497
do_new_mount fs/namespace.c:3040 [inline]
path_mount+0x1320/0x1fa0 fs/namespace.c:3370
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f4c1f9e079a
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f4c1f989168 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f4c1f9891c0 RCX: 00007f4c1f9e079a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007f4c1f989180
RBP: 000000000000008e R08: 00007f4c1f9891c0 R09: 00007f4c1f9896b8
R10: 0000000000000000 R11: 0000000000000286 R12: 00007f4c1f989180
R13: 0000000020000f50 R14: 0000000000000003 R15: 0000000000000004
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:workqueue_sysfs_unregister kernel/workqueue.c:5796 [inline]
RIP: 0010:destroy_workqueue+0x2e/0x800 kernel/workqueue.c:4430
Code: 49 89 fe 41 55 41 54 55 53 48 83 ec 08 e8 2a fe 2b 00 49 8d be 18 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 37 07 00 00 49 8b 9e 18 01 00 00 48 85 db 74 19
RSP: 0018:ffffc90002f6f818 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: ffff8880248b4000 RCX: 0000000000000000
RDX: 0000000000000023 RSI: ffffffff814e4606 RDI: 0000000000000118
RBP: ffff8880248b4000 R08: 0000000000000000 R09: ffffffff9007194f
R10: 0000000000000001 R11: 0000000000000001 R12: 00000000fffffff4
R13: 0000000000001000 R14: 0000000000000000 R15: ffff88801e866000
FS: 00007f4c1f989700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4c1fa2ff78 CR3: 000000002490a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 49 89 fe mov %rdi,%r14
3: 41 55 push %r13
5: 41 54 push %r12
7: 55 push %rbp
8: 53 push %rbx
9: 48 83 ec 08 sub $0x8,%rsp
d: e8 2a fe 2b 00 callq 0x2bfe3c
12: 49 8d be 18 01 00 00 lea 0x118(%r14),%rdi
19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
20: fc ff df
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 37 07 00 00 jne 0x76b
34: 49 8b 9e 18 01 00 00 mov 0x118(%r14),%rbx
3b: 48 85 db test %rbx,%rbx
3e: 74 19 je 0x59


---
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
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Christoph Hellwig

unread,
Apr 27, 2022, 7:02:16 PM4/27/22
to syzbot, c...@fb.com, dst...@suse.com, h...@lst.de, jo...@toxicpanda.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, w...@suse.com
#syz test git://git.infradead.org/users/hch/misc.git btrfs-workqueue-fix

Hillf Danton

unread,
Apr 27, 2022, 7:48:48 PM4/27/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Wed, 27 Apr 2022 10:42:21 -0700
Fixes 9d7bd4c387c1 by checking if workqueue is valid before destroying it.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/ 088fb7eff349

--- y/fs/btrfs/disk-io.c
+++ x/fs/btrfs/disk-io.c
@@ -2283,7 +2283,8 @@ static void btrfs_stop_all_workers(struc
btrfs_destroy_workqueue(fs_info->workers);
btrfs_destroy_workqueue(fs_info->endio_workers);
btrfs_destroy_workqueue(fs_info->endio_raid56_workers);
- destroy_workqueue(fs_info->rmw_workers);
+ if (fs_info->rmw_workers)
+ destroy_workqueue(fs_info->rmw_workers);
btrfs_destroy_workqueue(fs_info->endio_write_workers);
btrfs_destroy_workqueue(fs_info->endio_freespace_worker);
btrfs_destroy_workqueue(fs_info->delayed_workers);
--

syzbot

unread,
Apr 28, 2022, 1:05:14 AM4/28/22
to c...@fb.com, dst...@suse.com, h...@lst.de, jo...@toxicpanda.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, w...@suse.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+a2c720...@syzkaller.appspotmail.com

Tested on:

commit: ade4dbbb btrfs: don't call destroy_workqueue on NULL w..
git tree: git://git.infradead.org/users/hch/misc.git btrfs-workqueue-fix
kernel config: https://syzkaller.appspot.com/x/.config?x=17dad21e0facb5e6
dashboard link: https://syzkaller.appspot.com/bug?extid=a2c720e0f056114ea7c6
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Apr 28, 2022, 1:23:24 AM4/28/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+a2c720...@syzkaller.appspotmail.com

Tested on:

commit: 088fb7ef Add linux-next specific files for 20220426
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/
kernel config: https://syzkaller.appspot.com/x/.config?x=f49713d2574602b3
dashboard link: https://syzkaller.appspot.com/bug?extid=a2c720e0f056114ea7c6
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=11537ee2f00000

Vladis Dronov

unread,
Jan 11, 2023, 5:00:55 AM1/11/23
to syzkaller-bugs
fixed by: 385de0ef387d ("btrfs: use a normal workqueue for rmw_workers")
(a problem commit modified with a fix before merging to master)

#syz fix:  btrfs: use a normal workqueue for rmw_workers
Reply all
Reply to author
Forward
0 new messages