KVM: nVMX: Fix erroneous exception bitmap check
authorNadav Har'El <nyh@math.technion.ac.il>
Tue, 6 Mar 2012 14:39:22 +0000 (16:39 +0200)
committerAvi Kivity <avi@redhat.com>
Thu, 8 Mar 2012 12:14:23 +0000 (14:14 +0200)
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>
arch/x86/kvm/vmx.c

index 4a722a0b8e131fc945a7d0ccf0bb930d26424d8b..2c22fc788da23e5a70f45d621cfdd512a68bb38f 100644 (file)
@@ -1664,7 +1664,7 @@ static int nested_pf_handled(struct kvm_vcpu *vcpu)
        struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
 
        /* 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;
 
        nested_vmx_vmexit(vcpu);