Work around locking issues in logwakeup(). Instead of actually waking up
waiters, just set a flag in logwakeup(). The flag is later noted through
periodic polling. This lets the wakeup code run with sufficient locking.
logwakeup() is a very tricky place to take locks because the function
can be called in many different contexts. By not requiring locks in
the routine helps to keep printf(9) as usable as possible.
Fix misleading code. The kernel keeps using the original boot
descriptors even after bootstrap.
Undefined behavior (UB) can potentially be present anywhere in the
kernel. kubsan reports findings using printf() and assuming that calling
printf() is safe in all contexts can be problematic. Instead, defer
reporting of findings to the systq task queue.
Storage for findings is allocated early in the boot process in order to
catch potential UB during boot. The same findings are reported once the
task queue subsystem has been initialized.
Feedback from kettenis@ and ok mpi@