Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Sep 2020 22:40:39 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r365534 - stable/11/sbin/init
Message-ID:  <202009092240.089MedNr027404@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Sep  9 22:40:39 2020
New Revision: 365534
URL: https://svnweb.freebsd.org/changeset/base/365534

Log:
  MFC r365279:
  
  Remove risky compatability with old kernels
  
  The badsys() handler for SIGSYS was added as a transtion aid for kernels
  lacking sysctl() in 1993.  It is unsafe and unsound so remove it rather
  than running the risk of a privilege-dropping system call being silently
  omitted.
  
  This partially reverts SCCSID 6.12 (Berkeley) 03/03/93 "add code to
  change the system security level".
  
  Reviewed by:	mckusick, imp, kevans
  Obtained from:	CheriBSD
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D26289

Modified:
  stable/11/sbin/init/init.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/init/init.c
==============================================================================
--- stable/11/sbin/init/init.c	Wed Sep  9 22:40:14 2020	(r365533)
+++ stable/11/sbin/init/init.c	Wed Sep  9 22:40:39 2020	(r365534)
@@ -104,7 +104,6 @@ static void stall(const char *, ...) __printflike(1, 2
 static void warning(const char *, ...) __printflike(1, 2);
 static void emergency(const char *, ...) __printflike(1, 2);
 static void disaster(int);
-static void badsys(int);
 static void revoke_ttys(void);
 static int  runshutdown(void);
 static char *strk(char *);
@@ -305,9 +304,8 @@ invalid:
 	 * 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);
+	handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS,
+	    SIGXCPU, SIGXFSZ, 0);
 	handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP,
 	    SIGUSR1, SIGUSR2, 0);
 	handle(alrm_handler, SIGALRM, 0);
@@ -502,22 +500,6 @@ emergency(const char *message, ...)
 
 	vsyslog(LOG_EMERG, 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.
- */
-static void
-badsys(int sig)
-{
-	static int badcount = 0;
-
-	if (badcount++ < 25)
-		return;
-	disaster(sig);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009092240.089MedNr027404>