summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.h
diff options
context:
space:
mode:
authorXiao Guangrong <guangrong.xiao@linux.intel.com>2015-05-07 10:20:15 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2015-05-08 10:51:47 +0200
commitceee7df749da03fa17ab5dc7d06dffb4980a32db (patch)
tree1a909678834a1a1757f47658b2eaaffd4adb329a /arch/x86/kvm/mmu.h
parentKVM: remove pointless cpu hotplug messages (diff)
downloadlinux-ceee7df749da03fa17ab5dc7d06dffb4980a32db.tar.xz
linux-ceee7df749da03fa17ab5dc7d06dffb4980a32db.zip
KVM: MMU: fix smap permission check
Current permission check assumes that RSVD bit in PFEC is always zero, however, it is not true since MMIO #PF will use it to quickly identify MMIO access Fix it by clearing the bit if walking guest page table is needed Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.h')
-rw-r--r--arch/x86/kvm/mmu.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index c7d65637c851..06eb2fc1bab8 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -166,6 +166,8 @@ static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
int index = (pfec >> 1) +
(smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1));
+ WARN_ON(pfec & PFERR_RSVD_MASK);
+
return (mmu->permissions[index] >> pte_access) & 1;
}