Hi Alexander, Thanks for the reminder. I've tested your patch and it does seem to help: I've not seen the panics at reboot since it's been applied (it does reappear when I forget to install my own kernel after a snapshot upgrade and I boot into the snapshot kernel again).
Thanks for working on this! Paul On Tue, Jul 06, 2021 at 11:24:39PM +0200, Alexander Bluhm wrote: | On Mon, Jun 07, 2021 at 07:06:23PM -0600, Theo de Raadt wrote: | > > It loops until the kernel has halted the machine. init process | > > jumps between signal handler and page fault trap. | > | > Hmm. That is probably ok. | | Somehow I forgot about this mail thread. | | Can I commit the diff below? | | bluhm | | Index: kern/kern_sig.c | =================================================================== | RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sig.c,v | retrieving revision 1.281 | diff -u -p -r1.281 kern_sig.c | --- kern/kern_sig.c 10 May 2021 18:01:24 -0000 1.281 | +++ kern/kern_sig.c 6 Jul 2021 21:22:14 -0000 | @@ -842,10 +842,16 @@ trapsignal(struct proc *p, int signum, u | * 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); | } | -- >++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+ +++++++++++>-]<.>++[<------------>-]<+.--------------.[-] http://www.weirdnet.nl/