On Mon, Jun 07, 2021 at 05:53:23PM +0200, Paul de Weerd wrote:
> syncing disks... done
> panic: init died (signal 10, exit 0)

I am using this local diff to avoid the panic.

After VFS shutdown, init cannot map a missing page.  It is the page
that contains the signal handler's code.  Traditionally a process
would spin in such a case.  But OpenBSD changed it to receive a
fatal signal.  If that happens to init(8), the kernel panics.  This
diff causes init to spin.  In case of reboot, it spins only until
the kernel resets the machine.

When I came up with this diff in 2017, it was not considered the
correct fix.  Syncing file system and some UVM logic was changed.
This improved the situation, but never fixed it.

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     7 Jun 2021 16:40:19 -0000
@@ -842,10 +842,13 @@ 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.
+                * init(8) must live forever, it gets a SIGBUS when
+                * syncing disks unmaps its program pages.
                 */
                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);
        }

Reply via email to