[syzbot] WARNING in kernfs_remove_by_name_ns (3)

46 views
Skip to first unread message

syzbot

unread,
Nov 8, 2021, 6:24:27 AM11/8/21
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, t...@kernel.org
Hello,

syzbot found the following issue on:

HEAD commit: ce840177930f Merge tag 'defconfig-5.16' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1516eb12b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=647adc5a101c9bf3
dashboard link: https://syzkaller.appspot.com/bug?extid=93cbdd0ab421adc5275d
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+93cbdd...@syzkaller.appspotmail.com

------------[ cut here ]------------
kernfs: can not remove 'nr_tags', no directory
WARNING: CPU: 0 PID: 352 at fs/kernfs/dir.c:1535 kernfs_remove_by_name_ns+0x96/0xa0 fs/kernfs/dir.c:1535
Modules linked in:
CPU: 0 PID: 352 Comm: syz-executor.0 Not tainted 5.15.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:kernfs_remove_by_name_ns+0x96/0xa0 fs/kernfs/dir.c:1535
Code: 83 ff 48 c7 c7 20 7a b5 8b 41 bc fe ff ff ff e8 f0 d9 67 ff eb d9 e8 49 f9 83 ff 4c 89 e6 48 c7 c7 a0 64 9d 89 e8 a1 35 01 07 <0f> 0b 41 bc fe ff ff ff eb bb 41 57 41 56 41 55 49 89 d5 41 54 49
RSP: 0018:ffffc90004c8fa68 EFLAGS: 00010286
RAX: 0000000000000000 RBX: ffffffff8c206628 RCX: 0000000000000000
RDX: ffff88806f28ba00 RSI: ffffffff815f39c8 RDI: fffff52000991f3f
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000037c24
R10: ffffffff815ed7ae R11: 0000000000000000 R12: ffffffff89e2ae80
R13: 0000000000000000 R14: ffffffff89e2ada0 R15: dffffc0000000000
FS: 00007fe5eef0f700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7b90e723a4 CR3: 00000001e5ed8000 CR4: 0000000000350ef0
Call Trace:
<TASK>
kernfs_remove_by_name include/linux/kernfs.h:598 [inline]
remove_files+0x96/0x1c0 fs/sysfs/group.c:28
sysfs_remove_group+0x87/0x170 fs/sysfs/group.c:289
sysfs_remove_groups fs/sysfs/group.c:313 [inline]
sysfs_remove_groups+0x5c/0xa0 fs/sysfs/group.c:305
__kobject_del+0x89/0x200 lib/kobject.c:611
kobject_del lib/kobject.c:643 [inline]
kobject_del+0x3c/0x60 lib/kobject.c:635
blk_mq_unregister_hctx block/blk-mq-sysfs.c:183 [inline]
blk_mq_unregister_hctx block/blk-mq-sysfs.c:172 [inline]
blk_mq_sysfs_unregister+0x227/0x300 block/blk-mq-sysfs.c:302
__blk_mq_update_nr_hw_queues block/blk-mq.c:4102 [inline]
blk_mq_update_nr_hw_queues+0x48c/0xd30 block/blk-mq.c:4142
nbd_start_device+0x1f2/0xdd0 drivers/block/nbd.c:1357
nbd_start_device_ioctl drivers/block/nbd.c:1407 [inline]
__nbd_ioctl drivers/block/nbd.c:1481 [inline]
nbd_ioctl+0x5f3/0xb10 drivers/block/nbd.c:1521
blkdev_ioctl+0x37a/0x800 block/ioctl.c:597
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
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:0x7fe5f19baae9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe5eef0f188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fe5f1ace020 RCX: 00007fe5f19baae9
RDX: 0000000000000000 RSI: 000000000000ab03 RDI: 0000000000000005
RBP: 00007fe5f1a14f25 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd3b00747f R14: 00007fe5eef0f300 R15: 0000000000022000
</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.

syzbot

unread,
Dec 29, 2021, 2:50:30 PM12/29/21
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, t...@kernel.org
syzbot has found a reproducer for the following issue on:

HEAD commit: e7c124bd0463 Merge tag 'selinux-pr-20211228' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=160bdec3b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ebd4b29568807bc
dashboard link: https://syzkaller.appspot.com/bug?extid=93cbdd0ab421adc5275d
compiler: Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14f5025db00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1009b371b00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+93cbdd...@syzkaller.appspotmail.com

WARNING: CPU: 1 PID: 4574 at fs/kernfs/dir.c:1536 kernfs_remove_by_name_ns+0x61/0x90 fs/kernfs/dir.c:1535
Modules linked in:

CPU: 1 PID: 4574 Comm: syz-executor510 Not tainted 5.16.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:kernfs_remove_by_name_ns+0x61/0x90 fs/kernfs/dir.c:1535
Code: 48 89 c3 e8 e1 5f 7d ff 48 89 df e8 c9 e7 ff ff 31 db eb 29 e8 d0 5f 7d ff 48 c7 c7 00 95 83 8a 4c 89 fe 31 c0 e8 9f 46 47 ff <0f> 0b bb fe ff ff ff eb 16 e8 b1 5f 7d ff bb fe ff ff ff 48 c7 c7
RSP: 0018:ffffc900049779f0 EFLAGS: 00010246

RAX: 50855e28c77b3200 RBX: 0000000000000000 RCX: ffff888077b0d700
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: 1ffffffff15a67d0 R08: ffffffff816a1042 R09: ffffed10173667b1
R10: ffffed10173667b1 R11: 0000000000000000 R12: ffffffff8d112008
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffffff8ad33ee0
FS: 00007f9f18971700(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f9f1894fec8 CR3: 0000000014b98000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
kernfs_remove_by_name include/linux/kernfs.h:570 [inline]
remove_files fs/sysfs/group.c:28 [inline]
sysfs_remove_group+0xf7/0x280 fs/sysfs/group.c:288
sysfs_remove_groups+0x5b/0xb0 fs/sysfs/group.c:312
__kobject_del+0x84/0x310 lib/kobject.c:611
kobject_del+0x41/0x60 lib/kobject.c:643
blk_mq_unregister_hctx block/blk-mq-sysfs.c:183 [inline]
blk_mq_sysfs_unregister+0x215/0x300 block/blk-mq-sysfs.c:302
__blk_mq_update_nr_hw_queues block/blk-mq.c:4196 [inline]
blk_mq_update_nr_hw_queues+0x607/0x1250 block/blk-mq.c:4241
nbd_start_device+0x176/0xcb0 drivers/block/nbd.c:1347
nbd_start_device_ioctl drivers/block/nbd.c:1397 [inline]
__nbd_ioctl drivers/block/nbd.c:1471 [inline]
nbd_ioctl+0x30f/0xb80 drivers/block/nbd.c:1511
blkdev_ioctl+0x3ac/0x790 block/ioctl.c:609
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xfb/0x170 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f9f189c4379
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9f189712e8 EFLAGS: 00000246
ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f9f18a484e0 RCX: 00007f9f189c4379
RDX: 0000000000000000 RSI: 000000000000ab03 RDI: 0000000000000006
RBP: 00007f9f18a15194 R08: 0000000000000001 R09: 0000000000000035
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9f18a484ec
R13: 00007f9f189712f0 R14: 00007f9f18a484e8 R15: 0000000000000001
</TASK>

Hillf Danton

unread,
Apr 4, 2023, 9:54:37 PM4/4/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On 29 Dec 2021 11:50:29 -0800
> HEAD commit: e7c124bd0463 Merge tag 'selinux-pr-20211228' of git://git...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1009b371b00000

See if it could be reproduced upstream.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

syzbot

unread,
Apr 4, 2023, 10:22:24 PM4/4/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in kernfs_remove_by_name_ns

R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffebd636f0f R14: 00007f02791c2300 R15: 0000000000022000
</TASK>
kobject_add_internal failed for qgroups (error: -12 parent: 395ef67a-297e-477c-816d-cd80a5b93e5d)
------------[ cut here ]------------
kernfs: can not remove 'enabled', no directory
WARNING: CPU: 0 PID: 5606 at fs/kernfs/dir.c:1649 kernfs_remove_by_name_ns+0xf8/0x150 fs/kernfs/dir.c:1648
Modules linked in:
CPU: 0 PID: 5606 Comm: syz-executor.0 Not tainted 6.3.0-rc5-syzkaller-00022-g76f598ba7d8e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
RIP: 0010:kernfs_remove_by_name_ns+0xf8/0x150 fs/kernfs/dir.c:1648
Code: ff 03 48 89 df e8 d8 ef ff ff 48 89 df e8 70 94 ff ff 31 db eb 27 e8 f7 84 72 ff 48 c7 c7 80 97 f9 8a 4c 89 e6 e8 58 9c 3a ff <0f> 0b bb fe ff ff ff eb 12 e8 da 84 72 ff bb fe ff ff ff 4c 89 f7
RSP: 0018:ffffc900052e7b00 EFLAGS: 00010246
RAX: 52e2f0e0665e4a00 RBX: ffffffff8d44b9a0 RCX: ffff888023018000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffffffff81527c82 R09: fffff52000a5ced9
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffffff8b2a3960
R13: 0000000000000000 R14: ffffffff8b2a3900 R15: 0000000000000000
FS: 00007f02791c2700(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbb3bcd1d94 CR3: 000000002a4f4000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
kernfs_remove_by_name include/linux/kernfs.h:618 [inline]
remove_files fs/sysfs/group.c:28 [inline]
sysfs_remove_group+0xfe/0x2a0 fs/sysfs/group.c:288
sysfs_remove_groups+0x54/0xa0 fs/sysfs/group.c:312
__kobject_del+0x84/0x310 lib/kobject.c:587
kobject_del+0x45/0x60 lib/kobject.c:619
btrfs_sysfs_del_qgroups+0x1cd/0x230 fs/btrfs/sysfs.c:2258
btrfs_sysfs_add_qgroups+0x392/0x3c0 fs/btrfs/sysfs.c:2297
btrfs_quota_enable+0x235/0x1f40 fs/btrfs/qgroup.c:991
btrfs_ioctl_quota_ctl+0x141/0x180 fs/btrfs/ioctl.c:3682
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xf1/0x160 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:0x7f027848c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f02791c2168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f02785abf80 RCX: 00007f027848c0f9
RDX: 0000000020000000 RSI: 00000000c0109428 RDI: 0000000000000004
RBP: 00007f02791c21d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffebd636f0f R14: 00007f02791c2300 R15: 0000000000022000
</TASK>


Tested on:

commit: 76f598ba Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=114c8ba3c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d9a438ce47536f0c
dashboard link: https://syzkaller.appspot.com/bug?extid=93cbdd0ab421adc5275d
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Note: no patches were applied.

Hillf Danton

unread,
Apr 5, 2023, 2:31:11 AM4/5/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On 29 Dec 2021 11:50:29 -0800
> HEAD commit: e7c124bd0463 Merge tag 'selinux-pr-20211228' of git://git...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1009b371b00000

Bail out if kobj fails to init.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 76f598ba

--- x/fs/btrfs/sysfs.c
+++ y/fs/btrfs/sysfs.c
@@ -2282,8 +2282,11 @@ int btrfs_sysfs_add_qgroups(struct btrfs

ret = kobject_init_and_add(fs_info->qgroups_kobj, &qgroups_ktype,
fsid_kobj, "qgroups");
- if (ret < 0)
- goto out;
+ if (ret < 0) {
+ kobject_put(fs_info->qgroups_kobj);
+ fs_info->qgroups_kobj = NULL;
+ return ret;
+ }

rbtree_postorder_for_each_entry_safe(qgroup, next,
&fs_info->qgroup_tree, node) {
--

syzbot

unread,
Apr 5, 2023, 3:12:37 AM4/5/23
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+93cbdd...@syzkaller.appspotmail.com

Tested on:

commit: 76f598ba Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=121a4efdc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d9a438ce47536f0c
dashboard link: https://syzkaller.appspot.com/bug?extid=93cbdd0ab421adc5275d
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=15e507f1c80000

Note: testing is done by a robot and is best-effort only.

David Sterba

unread,
May 15, 2024, 12:29:48 PMMay 15
to syzbot, gre...@linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, t...@kernel.org
On Mon, Nov 08, 2021 at 03:24:26AM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: ce840177930f Merge tag 'defconfig-5.16' of git://git.kerne..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1516eb12b00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=647adc5a101c9bf3
> dashboard link: https://syzkaller.appspot.com/bug?extid=93cbdd0ab421adc5275d
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+93cbdd...@syzkaller.appspotmail.com
>
> ------------[ cut here ]------------
> kernfs: can not remove 'nr_tags', no directory
> WARNING: CPU: 0 PID: 352 at fs/kernfs/dir.c:1535 kernfs_remove_by_name_ns+0x96/0xa0 fs/kernfs/dir.c:1535

#syz set subsystems: kernfs

Remove btrfs from subsystems. Multiple reports, injected ENOMEM and
sysfs cannot remove the files and warns

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/kernfs/dir.c?id=d3fa86b1a7b4cdc4367acacea16b72e0a200b3d7#n1662

Tejun Heo

unread,
May 15, 2024, 3:09:03 PMMay 15
to David Sterba, syzbot, gre...@linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
I can't tell what's happening just from the backtrace but it looks like
kobject_del() is being removed twice or removed without being added. The
kobj doesn't have kernfs_node attached but then tries to remove the files
which triggers the warning. Could be a bug in blk-mq. Can't immediately tell
from scanning the source tho. A repro would be really helpful.

Thanks.

--
tejun
Reply all
Reply to author
Forward
0 new messages