KVM: MMU: fix check the reserved bits on the gpte of L2
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Mon, 5 Aug 2013 04:59:19 +0000 (12:59 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 7 Aug 2013 13:57:33 +0000 (15:57 +0200)
Current code always uses arch.mmu to check the reserved bits on guest gpte
which is valid only for L1 guest, we should use arch.nested_mmu instead when
we translate gva to gpa for the L2 guest

Fix it by using @mmu instead since it is adapted to the current mmu mode
automatically

The bug can be triggered when nested npt is used and L1 guest and L2 guest
use different mmu mode

Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/paging_tmpl.h

index 7769699d48a80caac0e1d8402280ab1e15b99bed..3a75828be29b59a853aca5f199a21b366de3e45a 100644 (file)
@@ -218,8 +218,7 @@ retry_walk:
                if (unlikely(!is_present_gpte(pte)))
                        goto error;
 
-               if (unlikely(is_rsvd_bits_set(&vcpu->arch.mmu, pte,
-                                             walker->level))) {
+               if (unlikely(is_rsvd_bits_set(mmu, pte, walker->level))) {
                        errcode |= PFERR_RSVD_MASK | PFERR_PRESENT_MASK;
                        goto error;
                }