aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-06-10 11:27:07 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:54 -0400
commit2aaf65e8c40468b198b709a765abe311f91c1a1d (patch)
treebdd3804ee2c76136c914798850ed760be40e8dc8 /arch/x86/kvm/mmu.c
parent48fc03174b125238c541cf00acd5e9b9dff6b9ba (diff)
KVM: MMU audit: audit_mappings tweaks
- Fail early in case gfn_to_pfn returns is_error_pfn. - For the pre pte write case, avoid spurious "gva is valid but spte is notrap" messages (the emulation code does the guest write first, so this particular case is OK). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 86433513fb71..50fe8541ed39 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3117,6 +3117,11 @@ static void audit_mappings_page(struct kvm_vcpu *vcpu, u64 page_pte,
3117 pfn_t pfn = gfn_to_pfn(vcpu->kvm, gfn); 3117 pfn_t pfn = gfn_to_pfn(vcpu->kvm, gfn);
3118 hpa_t hpa = (hpa_t)pfn << PAGE_SHIFT; 3118 hpa_t hpa = (hpa_t)pfn << PAGE_SHIFT;
3119 3119
3120 if (is_error_pfn(pfn)) {
3121 kvm_release_pfn_clean(pfn);
3122 continue;
3123 }
3124
3120 if (is_shadow_present_pte(ent) 3125 if (is_shadow_present_pte(ent)
3121 && (ent & PT64_BASE_ADDR_MASK) != hpa) 3126 && (ent & PT64_BASE_ADDR_MASK) != hpa)
3122 printk(KERN_ERR "xx audit error: (%s) levels %d" 3127 printk(KERN_ERR "xx audit error: (%s) levels %d"
@@ -3288,7 +3293,8 @@ static void kvm_mmu_audit(struct kvm_vcpu *vcpu, const char *msg)
3288 audit_msg = msg; 3293 audit_msg = msg;
3289 audit_rmap(vcpu); 3294 audit_rmap(vcpu);
3290 audit_write_protection(vcpu); 3295 audit_write_protection(vcpu);
3291 audit_mappings(vcpu); 3296 if (strcmp("pre pte write", audit_msg) != 0)
3297 audit_mappings(vcpu);
3292 audit_writable_sptes_have_rmaps(vcpu); 3298 audit_writable_sptes_have_rmaps(vcpu);
3293 dbg = olddbg; 3299 dbg = olddbg;
3294} 3300}