The badsys() function has been here since import.  Its comment
indicates that SIGSYS might arrive if the system doesn't support
sysctl, which is not applicable to us anymore, if ever.

The only legitimate case I can think of here, now, is the desire
to support dropping an old init(8) onto a new kernel and not having
the box panic immediately if it calls an obsolete syscall.

But that isn't something we support, no?  And if the kernel ABI is
changing such that init(8) is calling an obsolete syscall, there are
steps one can take to migrate init(8) to the new ABI to prevent the
situation.

So SIGSYS should cause a disaster() exit upon first receipt like
all the other signals we haven't defined behavior for.

Thoughts?  ok?

Index: init.c
===================================================================
RCS file: /cvs/src/sbin/init/init.c,v
retrieving revision 1.67
diff -u -p -r1.67 init.c
--- init.c      31 Jan 2018 15:57:44 -0000      1.67
+++ init.c      24 Aug 2018 15:12:11 -0000
@@ -91,7 +91,6 @@ void stall(char *, ...);
 void warning(char *, ...);
 void emergency(char *, ...);
 void disaster(int);
-void badsys(int);
 
 typedef enum {
        invalid_state,
@@ -261,9 +260,8 @@ main(int argc, char *argv[])
         * We catch or block signals rather than ignore them,
         * so that they get reset on exec.
         */
-       handle(badsys, SIGSYS, 0);
        handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV,
-           SIGBUS, SIGXCPU, SIGXFSZ, 0);
+           SIGBUS, SIGSYS, SIGXCPU, SIGXFSZ, 0);
        handle(transition_handler, SIGHUP, SIGINT, SIGTERM, SIGTSTP,
             SIGUSR1, SIGUSR2, 0);
        handle(alrm_handler, SIGALRM, 0);
@@ -377,22 +375,6 @@ emergency(char *message, ...)
        va_start(ap, message);
        vsyslog_r(LOG_EMERG, &sdata, message, ap);
        va_end(ap);
-}
-
-/*
- * Catch a SIGSYS signal.
- *
- * These may arise if a system does not support sysctl.
- * We tolerate up to 25 of these, then throw in the towel.
- */
-void
-badsys(int sig)
-{
-       static int badcount = 0;
-
-       if (badcount++ < 25)
-               return;
-       disaster(sig);
 }
 
 /*

Reply via email to