summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-10-19 20:10:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-16 12:29:52 +0300
commit9dc6bc3f22f08099a27c38c68983fbc419e879f3 (patch)
treecbc8ae471b05401b14d4a5ab3b14ddf4447ecf89 /arch/x86/kvm/mmu.c
parent515fa37a3e550ac7f291fb295b4e6174b6bbbd85 (diff)
downloadlinux-9dc6bc3f22f08099a27c38c68983fbc419e879f3.tar.xz
KVM: x86: Add is_executable_pte()
Extracted from commit d3e328f2cb01 "kvm: x86: mmu: Verify that restored PTE has needed perms in fast page fault". Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index a1edd19a1665..96a0601a47c4 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -338,6 +338,11 @@ static int is_last_spte(u64 pte, int level)
return 0;
}
+static bool is_executable_pte(u64 spte)
+{
+ return (spte & (shadow_x_mask | shadow_nx_mask)) == shadow_x_mask;
+}
+
static kvm_pfn_t spte_to_pfn(u64 pte)
{
return (pte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT;