[syzbot] [kernfs?] WARNING in kernfs_get (5)

21 views
Skip to first unread message

syzbot

unread,
May 8, 2024, 7:07:28ā€ÆAMMay 8
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, t...@kernel.org
Hello,

syzbot found the following issue on:

HEAD commit: 3d25a941ea50 Merge tag 'block-6.9-20240503' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15afe9ff180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3714fc09f933e505
dashboard link: https://syzkaller.appspot.com/bug?extid=2f44671e54488d20f0e6
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/e03ace4a616f/disk-3d25a941.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/14bf616395b8/vmlinux-3d25a941.xz
kernel image: https://storage.googleapis.com/syzbot-assets/197f0e10a223/bzImage-3d25a941.xz

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

usb 1-1: Direct firmware load for ueagle-atm/eagleI.fw failed with error -2
usb 1-1: Falling back to sysfs fallback for: ueagle-atm/eagleI.fw
------------[ cut here ]------------
WARNING: CPU: 0 PID: 927 at fs/kernfs/dir.c:526 kernfs_get+0x71/0x90 fs/kernfs/dir.c:526
Modules linked in:
CPU: 0 PID: 927 Comm: kworker/0:2 Not tainted 6.9.0-rc6-syzkaller-00227-g3d25a941ea50 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: events request_firmware_work_func
RIP: 0010:kernfs_get+0x71/0x90 fs/kernfs/dir.c:526
Code: 23 e8 b3 76 5f ff 48 89 df be 04 00 00 00 e8 e6 23 c4 ff f0 ff 03 eb 05 e8 9c 76 5f ff 5b 5d c3 cc cc cc cc e8 90 76 5f ff 90 <0f> 0b 90 eb d7 89 d9 80 e1 07 80 c1 03 38 c1 7c b7 48 89 df e8 e6
RSP: 0018:ffffc900046776e8 EFLAGS: 00010293
RAX: ffffffff82369a30 RBX: ffff888023bcf690 RCX: ffff888020f8bc00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff82369a04 R09: 1ffff11004779ed2
R10: dffffc0000000000 R11: ffffed1004779ed3 R12: ffffffff8c441320
R13: dffffc0000000000 R14: ffff888023bcf690 R15: ffffffff8c441338
FS: 0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1db245f256 CR3: 0000000060d26000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
internal_create_group+0x5a8/0x11d0 fs/sysfs/group.c:179
dpm_sysfs_add+0x69/0x280 drivers/base/power/sysfs.c:702
device_add+0x5c3/0xca0 drivers/base/core.c:3680
fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:86 [inline]
fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:162 [inline]
firmware_fallback_sysfs+0x307/0x9e0 drivers/base/firmware_loader/fallback.c:238
_request_firmware+0xcf5/0x12b0 drivers/base/firmware_loader/main.c:914
request_firmware_work_func+0x12a/0x280 drivers/base/firmware_loader/main.c:1165
process_one_work kernel/workqueue.c:3267 [inline]
process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3348
worker_thread+0x86d/0xd70 kernel/workqueue.c:3429
kthread+0x2f0/0x390 kernel/kthread.c:388
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</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.

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

syzbot

unread,
May 14, 2024, 11:44:45ā€ÆAMMay 14
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, syzkall...@googlegroups.com, t...@kernel.org
syzbot has found a reproducer for the following issue on:

HEAD commit: 26dd54d03cd9 Add linux-next specific files for 20240514
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1392596c980000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8af44e051929224
dashboard link: https://syzkaller.appspot.com/bug?extid=2f44671e54488d20f0e6
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=14b06900980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/dca5ce975d7a/disk-26dd54d0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/24844585ee37/vmlinux-26dd54d0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7ea82f6342f5/bzImage-26dd54d0.xz

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

usb 2-1: Direct firmware load for ueagle-atm/eagleI.fw failed with error -2
usb 2-1: Falling back to sysfs fallback for: ueagle-atm/eagleI.fw
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5166 at fs/kernfs/dir.c:526 kernfs_get+0x71/0x90 fs/kernfs/dir.c:526
Modules linked in:
CPU: 0 PID: 5166 Comm: kworker/0:4 Not tainted 6.9.0-next-20240514-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: events request_firmware_work_func
RIP: 0010:kernfs_get+0x71/0x90 fs/kernfs/dir.c:526
Code: 23 e8 63 b0 5e ff 48 89 df be 04 00 00 00 e8 96 6c c4 ff f0 ff 03 eb 05 e8 4c b0 5e ff 5b 5d c3 cc cc cc cc e8 40 b0 5e ff 90 <0f> 0b 90 eb d7 89 d9 80 e1 07 80 c1 03 38 c1 7c b7 48 89 df e8 96
RSP: 0018:ffffc90003bdf6e0 EFLAGS: 00010293
RAX: ffffffff82379c40 RBX: ffff8880770dff00 RCX: ffff88802729da00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff82379c14 R09: 1ffff1100ee1bfe0
R10: dffffc0000000000 R11: ffffed100ee1bfe1 R12: dffffc0000000000
R13: ffff88802a984008 R14: ffffffff8c4497f0 R15: ffff88802a984038
FS: 0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f55ba7ad988 CR3: 0000000024c16000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
sysfs_get include/linux/sysfs.h:786 [inline]
create_dir lib/kobject.c:89 [inline]
kobject_add_internal+0x4ba/0x8d0 lib/kobject.c:240
kobject_add_varg lib/kobject.c:374 [inline]
kobject_add+0x152/0x220 lib/kobject.c:426
device_add+0x4e5/0xbf0 drivers/base/core.c:3659
fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:86 [inline]
fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:162 [inline]
firmware_fallback_sysfs+0x307/0x9e0 drivers/base/firmware_loader/fallback.c:238
_request_firmware+0xcf5/0x12b0 drivers/base/firmware_loader/main.c:914
request_firmware_work_func+0x12a/0x280 drivers/base/firmware_loader/main.c:1165
process_one_work kernel/workqueue.c:3231 [inline]
process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
kthread+0x2f0/0x390 kernel/kthread.c:389
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>


---
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.

Hillf Danton

unread,
May 14, 2024, 7:23:38ā€ÆPMMay 14
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Tue, 14 May 2024 08:44:43 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 26dd54d03cd9 Add linux-next specific files for 20240514
> git tree: linux-next
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14b06900980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 26dd54d03cd9

--- l/drivers/base/firmware_loader/fallback.c
+++ f/drivers/base/firmware_loader/fallback.c
@@ -83,15 +83,15 @@ static int fw_load_sysfs_fallback(struct

dev_set_uevent_suppress(f_dev, true);

+ mutex_lock(&fw_lock);
+
retval = device_add(f_dev);
if (retval) {
dev_err(f_dev, "%s: device_register failed\n", __func__);
goto err_put_dev;
}

- mutex_lock(&fw_lock);
if (fw_load_abort_all || fw_state_is_aborted(fw_priv)) {
- mutex_unlock(&fw_lock);
retval = -EINTR;
goto out;
}
@@ -120,10 +120,12 @@ static int fw_load_sysfs_fallback(struct
} else if (fw_priv->is_paged_buf && !fw_priv->data)
retval = -ENOMEM;

+ mutex_lock(&fw_lock);
out:
device_del(f_dev);
err_put_dev:
put_device(f_dev);
+ mutex_unlock(&fw_lock);
return retval;
}

--

syzbot

unread,
May 14, 2024, 9:09:06ā€ÆPMMay 14
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:
possible deadlock in firmware_uevent

============================================
WARNING: possible recursive locking detected
6.9.0-next-20240514-syzkaller-dirty #0 Not tainted
--------------------------------------------
kworker/0:2/930 is trying to acquire lock:
ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: firmware_uevent+0x2f/0x1a0 drivers/base/firmware_loader/sysfs.c:84

but task is already holding lock:
ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:123 [inline]
ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:164 [inline]
ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: firmware_fallback_sysfs+0x755/0x9d0 drivers/base/firmware_loader/fallback.c:240

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(fw_lock);
lock(fw_lock);

*** DEADLOCK ***

May be due to missing lock nesting notation

4 locks held by kworker/0:2/930:
#0: ffff888015080948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline]
#0: ffff888015080948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312
#1: ffffc9000441fd00 ((work_completion)(&fw_work->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline]
#1: ffffc9000441fd00 ((work_completion)(&fw_work->work)){+.+.}-{0:0}, at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312
#2: ffffffff8e1dd630 (umhelper_sem){++++}-{3:3}, at: usermodehelper_read_lock_wait+0x14e/0x260 kernel/umh.c:247
#3: ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:123 [inline]
#3: ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:164 [inline]
#3: ffffffff8ec74268 (fw_lock){+.+.}-{3:3}, at: firmware_fallback_sysfs+0x755/0x9d0 drivers/base/firmware_loader/fallback.c:240

stack backtrace:
CPU: 0 PID: 930 Comm: kworker/0:2 Not tainted 6.9.0-next-20240514-syzkaller-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: events request_firmware_work_func
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
check_deadlock kernel/locking/lockdep.c:3062 [inline]
validate_chain+0x15c1/0x58e0 kernel/locking/lockdep.c:3856
__lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__mutex_lock_common kernel/locking/mutex.c:608 [inline]
__mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
firmware_uevent+0x2f/0x1a0 drivers/base/firmware_loader/sysfs.c:84
dev_uevent+0x4e4/0x900 drivers/base/core.c:2687
kobject_uevent_env+0x467/0x8e0 lib/kobject_uevent.c:558
device_del+0x7db/0x9b0 drivers/base/core.c:3928
fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:125 [inline]
fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:164 [inline]
firmware_fallback_sysfs+0x3a8/0x9d0 drivers/base/firmware_loader/fallback.c:240
_request_firmware+0xcf5/0x12b0 drivers/base/firmware_loader/main.c:914
request_firmware_work_func+0x12a/0x280 drivers/base/firmware_loader/main.c:1165
process_one_work kernel/workqueue.c:3231 [inline]
process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
kthread+0x2f0/0x390 kernel/kthread.c:389
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>


Tested on:

commit: 26dd54d0 Add linux-next specific files for 20240514
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=157a1c84980000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8af44e051929224
dashboard link: https://syzkaller.appspot.com/bug?extid=2f44671e54488d20f0e6
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=10776c68980000

Hillf Danton

unread,
May 15, 2024, 6:33:42ā€ÆAMMay 15
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Tue, 14 May 2024 08:44:43 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 26dd54d03cd9 Add linux-next specific files for 20240514
> git tree: linux-next
--- l/drivers/base/firmware_loader/sysfs.c
+++ s/drivers/base/firmware_loader/sysfs.c
@@ -81,10 +81,8 @@ static int firmware_uevent(const struct
const struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
int err = 0;

- mutex_lock(&fw_lock);
if (fw_sysfs->fw_priv)
err = do_firmware_uevent(fw_sysfs, env);
- mutex_unlock(&fw_lock);
return err;
}
#endif /* CONFIG_FW_LOADER_USER_HELPER */
--

syzbot

unread,
May 15, 2024, 2:09:08ā€ÆPMMay 15
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+2f4467...@syzkaller.appspotmail.com

Tested on:

commit: 26dd54d0 Add linux-next specific files for 20240514
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10bfc034980000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8af44e051929224
dashboard link: https://syzkaller.appspot.com/bug?extid=2f44671e54488d20f0e6
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1208dc7c980000

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

Hillf Danton

unread,
May 16, 2024, 10:28:12ā€ÆAMMay 16
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Tue, 14 May 2024 08:44:43 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 26dd54d03cd9 Add linux-next specific files for 20240514
> git tree: linux-next
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14b06900980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 26dd54d03cd9

--- l/drivers/base/firmware_loader/fallback.c
+++ f/drivers/base/firmware_loader/fallback.c
@@ -64,6 +64,7 @@ void kill_pending_fw_fallback_reqs(bool
mutex_unlock(&fw_lock);
}

+static DEFINE_MUTEX(fw_load_sysfs_mutex);
/**
* fw_load_sysfs_fallback() - load a firmware via the sysfs fallback mechanism
* @fw_sysfs: firmware sysfs information for the firmware to load
@@ -82,6 +83,7 @@ static int fw_load_sysfs_fallback(struct
fw_priv->is_paged_buf = true;

dev_set_uevent_suppress(f_dev, true);
+ mutex_lock(&fw_load_sysfs_mutex);

retval = device_add(f_dev);
if (retval) {
@@ -124,6 +126,7 @@ out:
device_del(f_dev);
err_put_dev:
put_device(f_dev);
+ mutex_unlock(&fw_load_sysfs_mutex);
return retval;
}

--

syzbot

unread,
May 16, 2024, 10:52:06ā€ÆAMMay 16
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+2f4467...@syzkaller.appspotmail.com

Tested on:

commit: 26dd54d0 Add linux-next specific files for 20240514
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10ccbf70980000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8af44e051929224
dashboard link: https://syzkaller.appspot.com/bug?extid=2f44671e54488d20f0e6
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13960e20980000
Reply all
Reply to author
Forward
0 new messages