浏览代码

[PATCH] KVM: MMU: Add missing dirty bit

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 <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Avi Kivity 18 年之前
父节点
当前提交
760db773fb
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      drivers/kvm/paging_tmpl.h

+ 1 - 0
drivers/kvm/paging_tmpl.h

@@ -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;
 	}