Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Rename spectreV2 -> spectre_v2, and introdu...



details:   https://anonhg.NetBSD.org/src/rev/10fa5a7ddca9
branches:  trunk
changeset: 321689:10fa5a7ddca9
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Mar 31 08:43:52 2018 +0000

description:
Rename spectreV2 -> spectre_v2, and introduce spectre_v1 (which defaults
to not-mitigated).

This gives the user an easy way to find out whether the system is
vulnerable:

        machdep.spectre_v1.mitigated
        machdep.spectre_v2.mitigated

They are also available on i386.

diffstat:

 sys/arch/x86/x86/x86_machdep.c |  25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 1f3030bc7f23 -r 10fa5a7ddca9 sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c    Sat Mar 31 08:30:01 2018 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c    Sat Mar 31 08:43:52 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_machdep.c,v 1.109 2018/03/14 17:40:41 maxv Exp $   */
+/*     $NetBSD: x86_machdep.c,v 1.110 2018/03/31 08:43:52 maxv Exp $   */
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.109 2018/03/14 17:40:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.110 2018/03/31 08:43:52 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -1274,10 +1274,27 @@
 #ifndef XEN
        int sysctl_machdep_spectreV2_mitigated(SYSCTLFN_ARGS);
        extern bool spec_mitigation_enabled;
-       const struct sysctlnode *spec_rnode = NULL;
+       const struct sysctlnode *spec_rnode;
+
+       /* SpectreV1 */
+       spec_rnode = NULL;
        sysctl_createv(clog, 0, NULL, &spec_rnode,
                       CTLFLAG_PERMANENT,
-                      CTLTYPE_NODE, "spectreV2", NULL,
+                      CTLTYPE_NODE, "spectre_v1", NULL,
+                      NULL, 0, NULL, 0,
+                      CTL_MACHDEP, CTL_CREATE);
+       sysctl_createv(clog, 0, &spec_rnode, &spec_rnode,
+                      CTLFLAG_PERMANENT | CTLFLAG_IMMEDIATE,
+                      CTLTYPE_BOOL, "mitigated",
+                      SYSCTL_DESCR("Whether Spectre Variant 1 is mitigated"),
+                      NULL, 0 /* mitigated=0 */, NULL, 0,
+                      CTL_CREATE, CTL_EOL);
+
+       /* SpectreV2 */
+       spec_rnode = NULL;
+       sysctl_createv(clog, 0, NULL, &spec_rnode,
+                      CTLFLAG_PERMANENT,
+                      CTLTYPE_NODE, "spectre_v2", NULL,
                       NULL, 0, NULL, 0,
                       CTL_MACHDEP, CTL_CREATE);
        sysctl_createv(clog, 0, &spec_rnode, &spec_rnode,



Home | Main Index | Thread Index | Old Index