Module Name:    src
Committed By:   jnemeth
Date:           Tue Oct 14 03:16:56 UTC 2014

Modified Files:
        src/sys/arch/x86/x86: identcpu.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/x86/x86/identcpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.45 src/sys/arch/x86/x86/identcpu.c:1.46
--- src/sys/arch/x86/x86/identcpu.c:1.45	Tue Jul  8 19:35:36 2014
+++ src/sys/arch/x86/x86/identcpu.c	Tue Oct 14 03:16:56 2014
@@ -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 @@ cpu_probe_fpu(struct cpu_info *ci)
 	/* 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

Reply via email to