diff mbox series

KVM: nVMX: Restore a preemption timer consistency check

Message ID 20190213004223.9922-1-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM: nVMX: Restore a preemption timer consistency check | expand

Commit Message

Sean Christopherson Feb. 13, 2019, 12:42 a.m. UTC
A recently added preemption timer consistency check was unintentionally
dropped when the consistency checks were being reorganized to match the
SDM's ordering.

Fixes: 461b4ba4c7ad ("KVM: nVMX: Move the checks for VM-Execution Control Fields to a separate helper function")
Cc: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---

The original bug fix, commit 14aa61d0a9eb ("nVMX x86: Check VMX-preemption
timer controls on vmentry of L2 guests"), was added in the v5.0 merge
window, i.e. this doesn't need to be backported to stable, but it should
get pushed to v5.0-rc7 if possible.

 arch/x86/kvm/vmx/nested.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Paolo Bonzini Feb. 13, 2019, 6:38 p.m. UTC | #1
On 13/02/19 01:42, Sean Christopherson wrote:
> A recently added preemption timer consistency check was unintentionally
> dropped when the consistency checks were being reorganized to match the
> SDM's ordering.
> 
> Fixes: 461b4ba4c7ad ("KVM: nVMX: Move the checks for VM-Execution Control Fields to a separate helper function")
> Cc: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> 
> The original bug fix, commit 14aa61d0a9eb ("nVMX x86: Check VMX-preemption
> timer controls on vmentry of L2 guests"), was added in the v5.0 merge
> window, i.e. this doesn't need to be backported to stable, but it should
> get pushed to v5.0-rc7 if possible.
> 
>  arch/x86/kvm/vmx/nested.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 2616bd2c7f2c..46f5b72e09e6 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -2472,6 +2472,10 @@ static int nested_check_vm_execution_controls(struct kvm_vcpu *vcpu,
>  	    (nested_cpu_has_vpid(vmcs12) && !vmcs12->virtual_processor_id))
>  		return -EINVAL;
>  
> +	if (!nested_cpu_has_preemption_timer(vmcs12) &&
> +	    nested_cpu_has_save_preemption_timer(vmcs12))
> +		return -EINVAL;
> +
>  	if (nested_cpu_has_ept(vmcs12) &&
>  	    !valid_ept_address(vcpu, vmcs12->ept_pointer))
>  		return -EINVAL;
> 

Queue, thanks.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 2616bd2c7f2c..46f5b72e09e6 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2472,6 +2472,10 @@  static int nested_check_vm_execution_controls(struct kvm_vcpu *vcpu,
 	    (nested_cpu_has_vpid(vmcs12) && !vmcs12->virtual_processor_id))
 		return -EINVAL;
 
+	if (!nested_cpu_has_preemption_timer(vmcs12) &&
+	    nested_cpu_has_save_preemption_timer(vmcs12))
+		return -EINVAL;
+
 	if (nested_cpu_has_ept(vmcs12) &&
 	    !valid_ept_address(vcpu, vmcs12->ept_pointer))
 		return -EINVAL;