ifconfig wgN destroy caused the kernel panic at wg_detach. After some investigation it seems wg_detach get called twice.
root@wgbsd-aws-west-1:~ # ifconfig wg0 destroy panic: Assertion mtx_unowned(m) failed at /usr/src/sys/kern/kern_mutex.c:1181 cpuid = 0 time = 1614728993 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00793396e0 vpanic() at vpanic+0x181/frame 0xfffffe0079339730 panic() at panic+0x43/frame 0xfffffe0079339790 _mtx_destroy() at _mtx_destroy+0x4c/frame 0xfffffe00793397b0 wg_detach() at wg_detach+0xa9/frame 0xfffffe00793397e0 iflib_pseudo_deregister() at iflib_pseudo_deregister+0xfe/frame 0xfffffe0079339810 if_clone_destroyif() at if_clone_destroyif+0x237/frame 0xfffffe0079339860 if_clone_destroy() at if_clone_destroy+0x1f1/frame 0xfffffe00793398b0 ifioctl() at ifioctl+0x685/frame 0xfffffe0079339980 kern_ioctl() at kern_ioctl+0x289/frame 0xfffffe00793399f0 sys_ioctl() at sys_ioctl+0x12a/frame 0xfffffe0079339ac0 amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe0079339bf0 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0079339bf0 --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8004288ca, rsp = 0x7fffffffd238, rbp = 0x7fffffffd250 --- KDB: enter: panic [ thread pid 39045 tid 100080 ] Stopped at kdb_enter+0x37: movq $0,0x128e40e(%rip) db>
Which rev? See PR 253583.
# uname -a FreeBSD wg 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n244733-c511a5ab53b: Thu Feb 11 07:07:14 UTC 2021 Will try again with a more recent current!
(In reply to Mark Johnston from comment #2) Confirmed with a more recent current (ee21ee1572d40a3b74f18638dae38c1a9ad1e9e3) this issue is gone.
(In reply to nyan from comment #4) Thanks. *** This bug has been marked as a duplicate of bug 253583 ***