diff mbox

[4/4] KVM: MMU audit: audit_mappings tweaks

Message ID 20090602214227.199310641@localhost.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Marcelo Tosatti June 2, 2009, 9:36 p.m. UTC
- 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>

Comments

Avi Kivity June 8, 2009, 9:29 a.m. UTC | #1
Marcelo Tosatti wrote:
> @@ -3256,7 +3261,8 @@ static void kvm_mmu_audit(struct kvm_vcp
>  	audit_msg = msg;
>  	audit_rmap(vcpu);
>  	audit_write_protection(vcpu);
> -	audit_mappings(vcpu);
> +	if (strcmp("pre pte write", audit_msg))
> +		audit_mappings(vcpu);
>  	audit_writable_sptes_have_rmaps(vcpu);
>  	dbg = olddbg;
>  }
>   

strcmp() doesn't return a truth value, please add != 0.
diff mbox

Patch

Index: kvm/arch/x86/kvm/mmu.c
===================================================================
--- kvm.orig/arch/x86/kvm/mmu.c
+++ kvm/arch/x86/kvm/mmu.c
@@ -3089,6 +3089,11 @@  static void audit_mappings_page(struct k
 			pfn_t pfn = gfn_to_pfn(vcpu->kvm, gfn);
 			hpa_t hpa = (hpa_t)pfn << PAGE_SHIFT;
 
+			if (is_error_pfn(pfn)) {
+				kvm_release_pfn_clean(pfn);
+				continue;
+			}
+
 			if (is_shadow_present_pte(ent)
 			    && (ent & PT64_BASE_ADDR_MASK) != hpa)
 				printk(KERN_ERR "xx audit error: (%s) levels %d"
@@ -3256,7 +3261,8 @@  static void kvm_mmu_audit(struct kvm_vcp
 	audit_msg = msg;
 	audit_rmap(vcpu);
 	audit_write_protection(vcpu);
-	audit_mappings(vcpu);
+	if (strcmp("pre pte write", audit_msg))
+		audit_mappings(vcpu);
 	audit_writable_sptes_have_rmaps(vcpu);
 	dbg = olddbg;
 }