-/* $OpenBSD: kern_sig.c,v 1.281 2021/05/10 18:01:24 mpi Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.282 2021/07/14 22:09:24 bluhm Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
* generated by the kernel, be ignorable or blockable.
* If it is and we're not being traced, then just kill
* the process.
+ * After vfs_shutdown(9), init(8) cannot receive signals
+ * because new code pages of the signal handler cannot be
+ * mapped from halted storage. init(8) may not die or the
+ * kernel panics. Better loop between signal handler and
+ * page fault trap until the machine is halted.
*/
if ((pr->ps_flags & PS_TRACED) == 0 &&
(sigprop[signum] & SA_KILL) &&
- ((p->p_sigmask & mask) || (ps->ps_sigignore & mask)))
+ ((p->p_sigmask & mask) || (ps->ps_sigignore & mask)) &&
+ pr->ps_pid != 1)
sigexit(p, signum);
ptsignal(p, signum, STHREAD);
}