From owner-svn-src-stable-11@freebsd.org Wed Sep 9 22:40:39 2020 Return-Path: Delivered-To: svn-src-stable-11@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 C95AD3DF79D; Wed, 9 Sep 2020 22:40:39 +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 4Bmxn34yBkz41gP; Wed, 9 Sep 2020 22:40:39 +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 8D683905A; Wed, 9 Sep 2020 22:40:39 +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 089Medh5027405; Wed, 9 Sep 2020 22:40:39 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 089MedNr027404; Wed, 9 Sep 2020 22:40:39 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202009092240.089MedNr027404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 9 Sep 2020 22:40:39 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sbin/init X-SVN-Commit-Revision: 365534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2020 22:40:39 -0000 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); } /*