ddb reset command results in LOR and panic? (audit related?)

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Thu, 30 Jan 2025 02:37:53 UTC
Hi.

I broke into the kernel debugger after some driver went haywire.

Upon typing reset to restart the machine I got the below.
How can we still report a LOR and panic on a lock when we
are resetting the machine from ddb?

/bz

db> reset
lock order reversal: (sleepable after non-sleepable)
  1st 0xfffff800031dfb40 thread (thread, sleep mutex) @ /sys/kern/subr_taskqueue.c:519
  2nd 0xffffffff81cdecd0 audit_worker_lock (audit_worker_lock, sx) @ /sys/security/audit/audit_worker.c:512
panic: lock (sx) kernel linker not locked @ /sys/kern/kern_linker.c:1130
cpuid = 3
time = 1738203974
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0068c67180
vpanic() at vpanic+0x136/frame 0xfffffe0068c672b0
panic() at panic+0x43/frame 0xfffffe0068c67310
witness_unlock() at witness_unlock+0x154/frame 0xfffffe0068c67340
_sx_sunlock_int() at _sx_sunlock_int+0x4a/frame 0xfffffe0068c67370
linker_search_symbol_name_flags() at linker_search_symbol_name_flags+0x90/frame 0xfffffe0068c673a0
stack_sbuf_print_flags() at stack_sbuf_print_flags+0x8e/frame 0xfffffe0068c67430
witness_checkorder() at witness_checkorder+0xbf6/frame 0xfffffe0068c675f0
_sx_xlock() at _sx_xlock+0x60/frame 0xfffffe0068c67630
audit_rotate_vnode() at audit_rotate_vnode+0xd0/frame 0xfffffe0068c67740
kern_reboot() at kern_reboot+0x2a3/frame 0xfffffe0068c67780
db_reset() at db_reset+0x108/frame 0xfffffe0068c677b0
db_command() at db_command+0x30d/frame 0xfffffe0068c67870
db_command_loop() at db_command_loop+0x4d/frame 0xfffffe0068c67880
db_trap() at db_trap+0xe6/frame 0xfffffe0068c67910
kdb_trap() at kdb_trap+0x24f/frame 0xfffffe0068c67a60
trap() at trap+0x3cb/frame 0xfffffe0068c67b80
calltrap() at calltrap+0x8/frame 0xfffffe0068c67b80
--- trap 0x3, rip = 0xffffffff80ba6f4d, rsp = 0xfffffe0068c67c50, rbp = 0xfffffe0068c67c60 ---
kdb_alt_break_internal() at kdb_alt_break_internal+0x15d/frame 0xfffffe0068c67c60
kdb_alt_break() at kdb_alt_break+0xb/frame 0xfffffe0068c67c70
uart_intr_rxready() at uart_intr_rxready+0xf4/frame 0xfffffe0068c67ca0
uart_intr() at uart_intr+0x138/frame 0xfffffe0068c67ce0
intr_event_handle() at intr_event_handle+0xc8/frame 0xfffffe0068c67d50
intr_execute_handlers() at intr_execute_handlers+0x63/frame 0xfffffe0068c67d80
Xapic_isr1() at Xapic_isr1+0xdc/frame 0xfffffe0068c67d80
--- interrupt, rip = 0xffffffff80bc0181, rsp = 0xfffffe0068c67e50, rbp = 0xfffffe0068c67ec0 ---
taskqueue_run_locked() at taskqueue_run_locked+0x11/frame 0xfffffe0068c67ec0
taskqueue_thread_loop() at taskqueue_thread_loop+0xd3/frame 0xfffffe0068c67ef0
fork_exit() at fork_exit+0x82/frame 0xfffffe0068c67f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0068c67f30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---
Uptime: 1h37m24s
Automatic reboot in 15 seconds - press a key on the console to abort


-- 
Bjoern A. Zeeb                                                     r15:7