[PATCH] KVM: MMU: If emulating an instruction fails, try unprotecting the page

A page table may have been recycled into a regular page, and so any
instruction can be executed on it.  Unprotect the page and let the cpu do its
thing.

Signed-off-by: Avi Kivity <avi@qumranet.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Avi Kivity
2007-01-05 16:36:45 -08:00
committed by Linus Torvalds
parent 9b7a032567
commit a436036baf
3 changed files with 61 additions and 0 deletions

View File

@@ -1063,6 +1063,8 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
}
if (r) {
if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
return EMULATE_DONE;
if (!vcpu->mmio_needed) {
report_emulation_failure(&emulate_ctxt);
return EMULATE_FAIL;