From owner-svn-src-head@freebsd.org Wed Sep 2 21:14:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD9553CA4D8; Wed, 2 Sep 2020 21:14:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BhcC054zKz4JgQ; Wed, 2 Sep 2020 21:14:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91B4110A1E; Wed, 2 Sep 2020 21:14:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 082LEauh017565; Wed, 2 Sep 2020 21:14:36 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 082LEaWb017564; Wed, 2 Sep 2020 21:14:36 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202009022114.082LEaWb017564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 2 Sep 2020 21:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365279 - head/sbin/init X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sbin/init X-SVN-Commit-Revision: 365279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 21:14:36 -0000 Author: brooks Date: Wed Sep 2 21:14:36 2020 New Revision: 365279 URL: https://svnweb.freebsd.org/changeset/base/365279 Log: 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 MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26289 Modified: head/sbin/init/init.c Modified: head/sbin/init/init.c ============================================================================== --- head/sbin/init/init.c Wed Sep 2 20:43:08 2020 (r365278) +++ head/sbin/init/init.c Wed Sep 2 21:14:36 2020 (r365279) @@ -106,7 +106,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 *); @@ -307,9 +306,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, SIGWINCH, 0); handle(alrm_handler, SIGALRM, 0); @@ -504,22 +502,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); } /*