Attempting to use the WebAuthn demo at https://webauthn.io/ with a Yubikey attached resulted in this panic: Tree is main @ 187ee62c71f2be62870f26ae98de865e330121be + (I believe) unrelated local changes. [49109.490855] panic: _mtx_lock_sleep: recursed on non-recursive mutex u2f lock @ /home/emaste/src/freebsd-git/wipbsd/sys/dev/hid/hidbus.c:609 [49109.539266] [49109.551110] cpuid = 3 [49109.562870] time = 1757694613 [49109.574567] KDB: stack backtrace: [49109.586371] db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01519446f0 [49109.599597] vpanic() at vpanic+0x136/frame 0xfffffe0151944820 [49109.612438] panic() at panic+0x43/frame 0xfffffe0151944880 [49109.625202] __mtx_lock_sleep() at __mtx_lock_sleep+0x485/frame 0xfffffe0151944910 [49109.638374] __mtx_lock_flags() at __mtx_lock_flags+0xdd/frame 0xfffffe0151944960 [49109.651353] hidbus_intr_start() at hidbus_intr_start+0x7c/frame 0xfffffe0151944990 [49109.664581] u2f_kqread() at u2f_kqread+0x4d/frame 0xfffffe01519449b0 [49109.678010] kqueue_register() at kqueue_register+0x82c/frame 0xfffffe0151944a30 [49109.691874] kqueue_kevent() at kqueue_kevent+0xc9/frame 0xfffffe0151944c90 [49109.705663] kern_kevent_fp() at kern_kevent_fp+0x9b/frame 0xfffffe0151944ce0 [49109.719744] kern_kevent() at kern_kevent+0x82/frame 0xfffffe0151944d40 [49109.733936] kern_kevent_generic() at kern_kevent_generic+0x70/frame 0xfffffe0151944da0 [49109.748574] sys_kevent() at sys_kevent+0x61/frame 0xfffffe0151944e00 [49109.763533] amd64_syscall() at amd64_syscall+0x174/frame 0xfffffe0151944f30 [49109.778470] fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0151944f30 [49109.793438] --- syscall (560, FreeBSD ELF64, kevent), rip = 0x114196327e8a, rsp = 0x1141aff91468, rbp = 0x1141aff914b0 --- [49109.808844] Uptime: 13h38m29s
Is this fallout from usbhid being the default?
> Is this fallout from usbhid being the default? Not directly, I think it's just a bug in the newly-added u2f(4)
Created attachment 264041 [details] add_taskqueue.patch I was not able to reproduce the bug as neither firefox nor my console clients use kqueue. Please test attached patch. I hope it works.
Thanks, I've applied the patch to my test tree and will let you know how it goes.
(In reply to Ed Maste from comment #4) With the patch I can successfully authenticate on https://webauthn.io/ now, thanks.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=186e433300fed9093dd9716baa20e838eb3b51b6 commit 186e433300fed9093dd9716baa20e838eb3b51b6 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2025-09-25 07:54:19 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2025-09-25 07:54:19 +0000 u2f(4): Use taskqueue to start USB transfers from kqueue context to avoid recursion on u2f mutex and taking of hidbus sleepable lock. Tested by: emaste PR: 289494 MFC after: 2 days sys/dev/hid/u2f.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d82a9494e7985dd9e3e8b5d31f9488e60972b865 commit d82a9494e7985dd9e3e8b5d31f9488e60972b865 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2025-09-25 07:54:19 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2025-09-27 10:25:05 +0000 u2f(4): Use taskqueue to start USB transfers from kqueue context to avoid recursion on u2f mutex and taking of hidbus sleepable lock. Tested by: emaste PR: 289494 MFC after: 2 days (cherry picked from commit 186e433300fed9093dd9716baa20e838eb3b51b6) sys/dev/hid/u2f.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)