From: "Jan Beulich" Subject: [PATCH] VMX: XSA-60 workaround Date: Tue, 13 Aug 2013 17:36:17 +0100 Message-ID: <520A7CA202000078000EB9DB@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartC1F29491.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1V9Ha2-00085u-Md for xen-devel@lists.xenproject.org; Tue, 13 Aug 2013 16:36:22 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser , Eddie Dong , Jun Nakajima List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartC1F29491.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Considering that there's still no real progress towards a resolution for XSA-60, I'd like to propose turning off the probelamtic code by default, allowing it to be turned back on via command line option. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -57,6 +57,14 @@ #include #include =20 +/* + * Option to allow VMX guests to run with caches disabled. This is = exposing + * the host to DoS attacks (due to the way vmx_set_uc_mode() works), and = hence + * needs to be disabled by default. + */ +static bool_t __read_mostly opt_permit_cache_disable; +boolean_param("vmx-permit-cache-disable", opt_permit_cache_disable); + enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised }; =20 static void vmx_ctxt_switch_from(struct vcpu *v); @@ -1133,6 +1141,8 @@ static void vmx_update_guest_cr(struct v =20 v->arch.hvm_vcpu.hw_cr[0] =3D v->arch.hvm_vcpu.guest_cr[0] | hw_cr0_mask; + if ( !opt_permit_cache_disable ) + v->arch.hvm_vcpu.hw_cr[0] &=3D ~(X86_CR0_CD | X86_CR0_NW); __vmwrite(GUEST_CR0, v->arch.hvm_vcpu.hw_cr[0]); __vmwrite(CR0_READ_SHADOW, v->arch.hvm_vcpu.guest_cr[0]); =20 @@ -1603,6 +1613,9 @@ const struct hvm_function_table * __init vmx_function_table.sync_pir_to_irr =3D NULL; } =20 + if ( !opt_permit_cache_disable ) + vmx_function_table.set_uc_mode =3D NULL; + setup_vmcs_dump(); =20 return &vmx_function_table; --=__PartC1F29491.1__= Content-Type: text/plain; name="xsa60.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xsa60.patch" VMX: XSA-60 workaround=0A=0AConsidering that there's still no real = progress towards a resolution=0Afor XSA-60, I'd like to propose turning = off the probelamtic code by=0Adefault, allowing it to be turned back on = via command line option.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/hvm/vmx/vmx.c=0A+++ b/xen/arch/x86/hvm/vmx/vmx.c= =0A@@ -57,6 +57,14 @@=0A #include =0A #include = =0A =0A+/*=0A+ * Option to allow VMX guests to run with = caches disabled. This is exposing=0A+ * the host to DoS attacks (due to = the way vmx_set_uc_mode() works), and hence=0A+ * needs to be disabled by = default.=0A+ */=0A+static bool_t __read_mostly opt_permit_cache_disable;=0A= +boolean_param("vmx-permit-cache-disable", opt_permit_cache_disable);=0A+= =0A enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised = };=0A =0A static void vmx_ctxt_switch_from(struct vcpu *v);=0A@@ -1133,6 = +1141,8 @@ static void vmx_update_guest_cr(struct v=0A =0A = v->arch.hvm_vcpu.hw_cr[0] =3D=0A v->arch.hvm_vcpu.guest_cr[0] = | hw_cr0_mask;=0A+ if ( !opt_permit_cache_disable )=0A+ = v->arch.hvm_vcpu.hw_cr[0] &=3D ~(X86_CR0_CD | X86_CR0_NW);=0A = __vmwrite(GUEST_CR0, v->arch.hvm_vcpu.hw_cr[0]);=0A __vmwrite(CR0_R= EAD_SHADOW, v->arch.hvm_vcpu.guest_cr[0]);=0A =0A@@ -1603,6 +1613,9 @@ = const struct hvm_function_table * __init=0A vmx_function_table.sync= _pir_to_irr =3D NULL;=0A }=0A =0A+ if ( !opt_permit_cache_disable = )=0A+ vmx_function_table.set_uc_mode =3D NULL;=0A+=0A setup_vmcs= _dump();=0A =0A return &vmx_function_table;=0A --=__PartC1F29491.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartC1F29491.1__=--