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 Force x86_xsave_features to 0 when running ...



details:   https://anonhg.NetBSD.org/src/rev/beaef3f85f62
branches:  trunk
changeset: 803145:beaef3f85f62
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Tue Oct 14 03:16:56 2014 +0000

description:
Force x86_xsave_features to 0 when running under XEN for AMD
processors.  This prevents the use of xsave and xrstor thus fixing
the problem in PR/49150.  The basic problem is that the way AMD
implements those instructions means that information can leak
between domains so XEN treats them as privileged.

XXX If anybody else comes up with a better / more "proper" fix, go
for it.  However, this solves the problem I was having.  And, given
that XEN being broken is pretty much a show-stopper for a release,
something needed to be done.

diffstat:

 sys/arch/x86/x86/identcpu.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r cfede6934131 -r beaef3f85f62 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Tue Oct 14 01:04:39 2014 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Tue Oct 14 03:16:56 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identcpu.c,v 1.45 2014/07/08 19:35:36 msaitoh Exp $    */
+/*     $NetBSD: identcpu.c,v 1.46 2014/10/14 03:16:56 jnemeth Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.45 2014/07/08 19:35:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.46 2014/10/14 03:16:56 jnemeth Exp $");
 
 #include "opt_xen.h"
 
@@ -757,7 +757,10 @@
        /* XXX these probably ought to be per-cpu */
        if (descs[2] > 512)
            x86_fpu_save_size = descs[2];
-       x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
+#ifdef XEN
+       if (cpu_vendor != CPUVENDOR_AMD)
+#endif
+               x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
 }
 
 void



Home | Main Index | Thread Index | Old Index