diff options
author | Gleb Natapov <gleb@redhat.com> | 2010-05-10 04:16:56 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 03:35:40 -0400 |
commit | 6d77dbfc88e37c9efd5c5dd18445cfe819ae17ea (patch) | |
tree | 96a3afb750d254a99dd43fa4730fd6ff187eb2a0 /arch/x86/kvm/mmu.c | |
parent | 57bc24cfd655c912498983130326b312e0404db1 (diff) |
KVM: inject #UD if instruction emulation fails and exit to userspace
Do not kill VM when instruction emulation fails. Inject #UD and report
failure to userspace instead. Userspace may choose to reenter guest if
vcpu is in userspace (cpl == 3) in which case guest OS will kill
offending process and continue running.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index be981b1f1881..4a02dee1f2b5 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2814,11 +2814,8 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code) | |||
2814 | return 1; | 2814 | return 1; |
2815 | case EMULATE_DO_MMIO: | 2815 | case EMULATE_DO_MMIO: |
2816 | ++vcpu->stat.mmio_exits; | 2816 | ++vcpu->stat.mmio_exits; |
2817 | return 0; | 2817 | /* fall through */ |
2818 | case EMULATE_FAIL: | 2818 | case EMULATE_FAIL: |
2819 | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | ||
2820 | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; | ||
2821 | vcpu->run->internal.ndata = 0; | ||
2822 | return 0; | 2819 | return 0; |
2823 | default: | 2820 | default: |
2824 | BUG(); | 2821 | BUG(); |