]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
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)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 30 May 2012 23:43:12 +0000 (00:43 +0100)
(cherry picked from commit 9587190107d0c0cbaccbf7bf6b0245d29095a9ae)

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kvm/vmx.c

index 4ea76784fe65a54791f1640bd898f703205e309c..7ac59930d40e17573ec2d45c28eff3bc8885237b 100644 (file)
@@ -1677,7 +1677,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);