From: Paolo Bonzini Subject: Re: [PATCH] kvm: nVMX: Don't validate disabled secondary controls Date: Fri, 5 May 2017 10:08:39 +0200 Message-ID: <6e978301-decb-a089-66c8-36c38ac3b96f@redhat.com> References: <20170504185158.91991-1-jmattson@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Jim Mattson , kvm@vger.kernel.org Return-path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:33355 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbdEEIIn (ORCPT ); Fri, 5 May 2017 04:08:43 -0400 Received: by mail-wm0-f66.google.com with SMTP id y10so8134494wmh.0 for ; Fri, 05 May 2017 01:08:43 -0700 (PDT) In-Reply-To: <20170504185158.91991-1-jmattson@google.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 04/05/2017 20:51, Jim Mattson wrote: > According to the SDM, if the "activate secondary controls" primary > processor-based VM-execution control is 0, no checks are performed on > the secondary processor-based VM-execution controls. > > Signed-off-by: Jim Mattson > --- > arch/x86/kvm/vmx.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index b2daee0bfb35..9142b31ae9d2 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -10314,9 +10314,10 @@ static int check_vmentry_prereqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) > if (!vmx_control_verify(vmcs12->cpu_based_vm_exec_control, > vmx->nested.nested_vmx_procbased_ctls_low, > vmx->nested.nested_vmx_procbased_ctls_high) || > - !vmx_control_verify(vmcs12->secondary_vm_exec_control, > - vmx->nested.nested_vmx_secondary_ctls_low, > - vmx->nested.nested_vmx_secondary_ctls_high) || > + (nested_cpu_has(vmcs12, CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) && > + !vmx_control_verify(vmcs12->secondary_vm_exec_control, > + vmx->nested.nested_vmx_secondary_ctls_low, > + vmx->nested.nested_vmx_secondary_ctls_high)) || > !vmx_control_verify(vmcs12->pin_based_vm_exec_control, > vmx->nested.nested_vmx_pinbased_ctls_low, > vmx->nested.nested_vmx_pinbased_ctls_high) || > Applied to kvm/queue, thanks. Paolo