On a WIP branch from main as of today, 4e22cd3bf0b4112e541bc585a6be57662cb0b52b To reproduce, `kldload kgssapi.ko && kldunload kgssapi.ko` panic: __rw_wlock_hard: recursing but non-recursive rw 0xffffffff81cd6e60 @ /home/emaste/src/freebsd-git/wipbsd/sys/rpc/clnt_nl.c:467 cpuid = 0 time = 1764260052 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004ad98a80 vpanic() at vpanic+0x136/frame 0xfffffe004ad98bb0 panic() at panic+0x43/frame 0xfffffe004ad98c10 __rw_wlock_hard() at __rw_wlock_hard+0x7c7/frame 0xfffffe004ad98cb0 _rw_wlock_cookie() at _rw_wlock_cookie+0xac/frame 0xfffffe004ad98cf0 clnt_nl_destroy() at clnt_nl_destroy+0x199/frame 0xfffffe004ad98d10 kgssapi_modevent() at kgssapi_modevent+0x2c8/frame 0xfffffe004ad98d50 module_unload() at module_unload+0x38/frame 0xfffffe004ad98d70 linker_file_unload() at linker_file_unload+0x22b/frame 0xfffffe004ad98dc0 kern_kldunload() at kern_kldunload+0x190/frame 0xfffffe004ad98e00 amd64_syscall() at amd64_syscall+0x174/frame 0xfffffe004ad98f30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe004ad98f30
Introduced in ad704a34bc2c, which added kgss_unload() and mtx_destroy(&kgss_gssd_lock) to the MOD_UNLOAD case above the comment which states unload is not supported and falls through to error = EOPNOTSUPP.
^Triage: Cc: committer of ad704a34bc2c .
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6901376f59b870ddbb0d922e3455a388333cd460 commit 6901376f59b870ddbb0d922e3455a388333cd460 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2025-11-27 16:44:08 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-11-28 01:29:55 +0000 kgssapi: Remove broken MOD_UNLOAD code The module panicked at unload with "recursing but non-recursive rw". There is a comment that "Unloading of the kgssapi module is not currently supported" and the MOD_UNLOAD case falls through to returning EOPNOTSUPP anyway. Just #if 0 the code in the unload path, leaving it as a hint in case someone implements unload support later on. PR: 291249 Reviewed by: rmacklem Fixes: ad704a34bc2c ("Use syscall_helper_register(9) rather than syscall_register().") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53949 sys/kgssapi/gss_impl.c | 4 ++++ 1 file changed, 4 insertions(+)