Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src Pull up following revision(s) (requested by alnsn in tick...



details:   https://anonhg.NetBSD.org/src/rev/97e9b2efe344
branches:  netbsd-8
changeset: 434955:97e9b2efe344
user:      martin <martin%NetBSD.org@localhost>
date:      Sat May 05 15:11:53 2018 +0000

description:
Pull up following revision(s) (requested by alnsn in ticket #790):

        share/man/man9/secmodel_securelevel.9: revision 1.16
        sys/secmodel/suser/secmodel_suser.c: revision 1.44
        sys/secmodel/securelevel/secmodel_securelevel.c: revision 1.31
        sys/sys/kauth.h: revision 1.76
        sys/arch/x86/x86/svs.c: revision 1.18

Add KAUTH_MACHDEP_SVS_DISABLE and add support to secmodel_securelevel(9).
Disabling SVS is denied at securelevel 1 and above.

Add SVS. It may not be disabled at securelevel 1 and above.

diffstat:

 share/man/man9/secmodel_securelevel.9           |   6 ++++--
 sys/arch/x86/x86/svs.c                          |  15 +++++++++------
 sys/secmodel/securelevel/secmodel_securelevel.c |   9 +++++++--
 sys/secmodel/suser/secmodel_suser.c             |   5 +++--
 sys/sys/kauth.h                                 |   5 +++--
 5 files changed, 26 insertions(+), 14 deletions(-)

diffs (146 lines):

diff -r 211c78e78f0d -r 97e9b2efe344 share/man/man9/secmodel_securelevel.9
--- a/share/man/man9/secmodel_securelevel.9     Sat May 05 15:08:14 2018 +0000
+++ b/share/man/man9/secmodel_securelevel.9     Sat May 05 15:11:53 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: secmodel_securelevel.9,v 1.15 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: secmodel_securelevel.9,v 1.15.18.1 2018/05/05 15:11:53 martin Exp $
 .\"
 .\" Copyright (c) 2006 Elad Efrat <elad%NetBSD.org@localhost>
 .\" Copyright (c) 2000 Hugh Graham
@@ -26,7 +26,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 22, 2012
+.Dd April 26, 2018
 .Dt SECMODEL_SECURELEVEL 9
 .Os
 .Sh NAME
@@ -136,6 +136,8 @@
 Only GPIO pins that have been set at
 .Em securelevel
 0 can be accessed.
+.It
+SVS (Separate Virtual Space) may not be disabled on platforms that support it.
 .El
 .It \ 2 Em Highly secure mode
 .Bl -bullet
diff -r 211c78e78f0d -r 97e9b2efe344 sys/arch/x86/x86/svs.c
--- a/sys/arch/x86/x86/svs.c    Sat May 05 15:08:14 2018 +0000
+++ b/sys/arch/x86/x86/svs.c    Sat May 05 15:11:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svs.c,v 1.14.2.3 2018/04/02 08:43:58 martin Exp $      */
+/*     $NetBSD: svs.c,v 1.14.2.4 2018/05/05 15:11:53 martin Exp $      */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14.2.3 2018/04/02 08:43:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14.2.4 2018/05/05 15:11:53 martin Exp $");
 
 #include "opt_svs.h"
 
@@ -38,6 +38,7 @@
 #include <sys/systm.h>
 #include <sys/proc.h>
 #include <sys/cpu.h>
+#include <sys/kauth.h>
 #include <sys/sysctl.h>
 #include <sys/xcall.h>
 
@@ -737,11 +738,13 @@
                        error = 0;
                else
                        error = EOPNOTSUPP;
-       } else {
-               if (svs_enabled)
+       } else if (svs_enabled) {
+               error = kauth_authorize_machdep(kauth_cred_get(),
+                   KAUTH_MACHDEP_SVS_DISABLE, NULL, NULL, NULL, NULL);
+               if (!error)
                        error = svs_disable();
-               else
-                       error = 0;
+       } else {
+               error = 0;
        }
 
        return error;
diff -r 211c78e78f0d -r 97e9b2efe344 sys/secmodel/securelevel/secmodel_securelevel.c
--- a/sys/secmodel/securelevel/secmodel_securelevel.c   Sat May 05 15:08:14 2018 +0000
+++ b/sys/secmodel/securelevel/secmodel_securelevel.c   Sat May 05 15:11:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_securelevel.c,v 1.30 2014/02/25 18:30:13 pooka Exp $ */
+/* $NetBSD: secmodel_securelevel.c,v 1.30.22.1 2018/05/05 15:11:53 martin Exp $ */
 /*-
  * Copyright (c) 2006 Elad Efrat <elad%NetBSD.org@localhost>
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.30 2014/02/25 18:30:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.30.22.1 2018/05/05 15:11:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_insecure.h"
@@ -494,6 +494,11 @@
                        result = KAUTH_RESULT_DENY;
                break;
 
+       case KAUTH_MACHDEP_SVS_DISABLE:
+               if (securelevel > 0)
+                       result = KAUTH_RESULT_DENY;
+               break;
+
        case KAUTH_MACHDEP_CPU_UCODE_APPLY:
                if (securelevel > 1)
                        result = KAUTH_RESULT_DENY;
diff -r 211c78e78f0d -r 97e9b2efe344 sys/secmodel/suser/secmodel_suser.c
--- a/sys/secmodel/suser/secmodel_suser.c       Sat May 05 15:08:14 2018 +0000
+++ b/sys/secmodel/suser/secmodel_suser.c       Sat May 05 15:11:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_suser.c,v 1.42.10.1 2017/08/01 23:18:30 snj Exp $ */
+/* $NetBSD: secmodel_suser.c,v 1.42.10.2 2018/05/05 15:11:53 martin Exp $ */
 /*-
  * Copyright (c) 2006 Elad Efrat <elad%NetBSD.org@localhost>
  * All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.42.10.1 2017/08/01 23:18:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.42.10.2 2018/05/05 15:11:53 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -854,6 +854,7 @@
        case KAUTH_MACHDEP_UNMANAGEDMEM:
        case KAUTH_MACHDEP_PXG:
        case KAUTH_MACHDEP_X86PMC:
+       case KAUTH_MACHDEP_SVS_DISABLE:
                if (isroot)
                        result = KAUTH_RESULT_ALLOW;
                break;
diff -r 211c78e78f0d -r 97e9b2efe344 sys/sys/kauth.h
--- a/sys/sys/kauth.h   Sat May 05 15:08:14 2018 +0000
+++ b/sys/sys/kauth.h   Sat May 05 15:11:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kauth.h,v 1.73.10.2 2018/04/12 13:42:49 martin Exp $ */
+/* $NetBSD: kauth.h,v 1.73.10.3 2018/05/05 15:11:53 martin Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat <elad%NetBSD.org@localhost>  
@@ -320,7 +320,8 @@
        KAUTH_MACHDEP_NVRAM,
        KAUTH_MACHDEP_UNMANAGEDMEM,
        KAUTH_MACHDEP_PXG,
-       KAUTH_MACHDEP_X86PMC
+       KAUTH_MACHDEP_X86PMC,
+       KAUTH_MACHDEP_SVS_DISABLE
 };
 
 /*



Home | Main Index | Thread Index | Old Index