Browse Source

KVM: nVMX: Fix erroneous exception bitmap check

The code which checks whether to inject a pagefault to L1 or L2 (in
nested VMX) was wrong, incorrect in how it checked the PF_VECTOR bit.
Thanks to Dan Carpenter for spotting this.

Signed-off-by: Nadav Har'El <nyh@il.ibm.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Nadav Har'El 13 years ago
parent
commit
9587190107
1 changed files with 1 additions and 1 deletions
  1. 1 1
      arch/x86/kvm/vmx.c

+ 1 - 1
arch/x86/kvm/vmx.c

@@ -1664,7 +1664,7 @@ static int nested_pf_handled(struct kvm_vcpu *vcpu)
 	struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
 	struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
 
 
 	/* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
 	/* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
-	if (!(vmcs12->exception_bitmap & PF_VECTOR))
+	if (!(vmcs12->exception_bitmap & (1u << PF_VECTOR)))
 		return 0;
 		return 0;
 
 
 	nested_vmx_vmexit(vcpu);
 	nested_vmx_vmexit(vcpu);