aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-06-10 11:27:05 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:53 -0400
commite58b0f9e0e2c17112e375a3f0ca1ef7e57730f68 (patch)
treeb1e92f21b8e4754938376eb4f4da1df5b7494e6f
parent08a3732bf2e68048c9166e929ca2115127a412ab (diff)
KVM: MMU audit: update audit_write_protection
- Unsync pages contain writable sptes in the rmap. - rmaps do not exclusively contain writable sptes anymore. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/mmu.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index fd5579cc8ab..4c2585cab18 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3260,20 +3260,28 @@ static void audit_write_protection(struct kvm_vcpu *vcpu)
3260 struct kvm_mmu_page *sp; 3260 struct kvm_mmu_page *sp;
3261 struct kvm_memory_slot *slot; 3261 struct kvm_memory_slot *slot;
3262 unsigned long *rmapp; 3262 unsigned long *rmapp;
3263 u64 *spte;
3263 gfn_t gfn; 3264 gfn_t gfn;
3264 3265
3265 list_for_each_entry(sp, &vcpu->kvm->arch.active_mmu_pages, link) { 3266 list_for_each_entry(sp, &vcpu->kvm->arch.active_mmu_pages, link) {
3266 if (sp->role.direct) 3267 if (sp->role.direct)
3267 continue; 3268 continue;
3269 if (sp->unsync)
3270 continue;
3268 3271
3269 gfn = unalias_gfn(vcpu->kvm, sp->gfn); 3272 gfn = unalias_gfn(vcpu->kvm, sp->gfn);
3270 slot = gfn_to_memslot_unaliased(vcpu->kvm, sp->gfn); 3273 slot = gfn_to_memslot_unaliased(vcpu->kvm, sp->gfn);
3271 rmapp = &slot->rmap[gfn - slot->base_gfn]; 3274 rmapp = &slot->rmap[gfn - slot->base_gfn];
3272 if (*rmapp) 3275
3273 printk(KERN_ERR "%s: (%s) shadow page has writable" 3276 spte = rmap_next(vcpu->kvm, rmapp, NULL);
3274 " mappings: gfn %lx role %x\n", 3277 while (spte) {
3278 if (*spte & PT_WRITABLE_MASK)
3279 printk(KERN_ERR "%s: (%s) shadow page has "
3280 "writable mappings: gfn %lx role %x\n",
3275 __func__, audit_msg, sp->gfn, 3281 __func__, audit_msg, sp->gfn,
3276 sp->role.word); 3282 sp->role.word);
3283 spte = rmap_next(vcpu->kvm, rmapp, spte);
3284 }
3277 } 3285 }
3278} 3286}
3279 3287