All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: nVMX: Don't validate disabled secondary controls
@ 2017-05-04 18:51 Jim Mattson
  2017-05-05  8:08 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Mattson @ 2017-05-04 18:51 UTC (permalink / raw)
  To: kvm; +Cc: Jim Mattson

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 <jmattson@google.com>
---
 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) ||
-- 
2.13.0.rc1.294.g07d810a77f-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm: nVMX: Don't validate disabled secondary controls
  2017-05-04 18:51 [PATCH] kvm: nVMX: Don't validate disabled secondary controls Jim Mattson
@ 2017-05-05  8:08 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2017-05-05  8:08 UTC (permalink / raw)
  To: Jim Mattson, kvm



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 <jmattson@google.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-05  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 18:51 [PATCH] kvm: nVMX: Don't validate disabled secondary controls Jim Mattson
2017-05-05  8:08 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.