[PATCH] KVM: MMU: Add missing dirty bit
authorAvi Kivity <[email protected]>
Sat, 6 Jan 2007 00:36:59 +0000 (16:36 -0800)
committerLinus Torvalds <[email protected]>
Sat, 6 Jan 2007 07:55:28 +0000 (23:55 -0800)
If we emulate a write, we fail to set the dirty bit on the guest pte, leading
the guest to believe the page is clean, and thus lose data.  Bad.

Fix by setting the guest pte dirty bit under such conditions.

Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/kvm/paging_tmpl.h

index c894b51ba3f80c3f57a1cd1402ee50d7adc0f0b4..2dbf4307ed9ed1e5ea7629bcd551c4b32f3eed08 100644 (file)
@@ -317,6 +317,7 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
        } else if (kvm_mmu_lookup_page(vcpu, gfn)) {
                pgprintk("%s: found shadow page for %lx, marking ro\n",
                         __FUNCTION__, gfn);
+               *guest_ent |= PT_DIRTY_MASK;
                *write_pt = 1;
                return 0;
        }