Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2019 23:54:51 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343166 - head/sys/amd64/vmm
Message-ID:  <201901182354.x0INspeZ015766@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Fri Jan 18 23:54:51 2019
New Revision: 343166
URL: https://svnweb.freebsd.org/changeset/base/343166

Log:
  vmm(4): Mask Spectre feature bits on AMD hosts
  
  For parity with Intel hosts, which already mask out the CPUID feature
  bits that indicate the presence of the SPEC_CTRL MSR, do the same on
  AMD.
  
  Eventually we may want to have a better support story for guests, but
  for now, limit the damage of incorrectly indicating an MSR we do not yet
  support.
  
  Eventually, we may want a generic CPUID override system for
  administrators, or for minimum supported feature set in heterogenous
  environments with failover.  That is a much larger scope effort than
  this bug fix.
  
  PR:		235010
  Reported by:	Rys Sommefeldt <rys AT sommefeldt.com>
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/amd64/vmm/x86.c

Modified: head/sys/amd64/vmm/x86.c
==============================================================================
--- head/sys/amd64/vmm/x86.c	Fri Jan 18 23:26:31 2019	(r343165)
+++ head/sys/amd64/vmm/x86.c	Fri Jan 18 23:54:51 2019	(r343166)
@@ -136,6 +136,14 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id,
 		case CPUID_8000_0008:
 			cpuid_count(*eax, *ecx, regs);
 			if (vmm_is_amd()) {
+				/*
+				 * As on Intel (0000_0007:0, EDX), mask out
+				 * unsupported or unsafe AMD extended features
+				 * (8000_0008 EBX).
+				 */
+				regs[1] &= (AMDFEID_CLZERO | AMDFEID_IRPERF |
+				    AMDFEID_XSAVEERPTR);
+
 				vm_get_topology(vm, &sockets, &cores, &threads,
 				    &maxcpus);
 				/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901182354.x0INspeZ015766>