diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2013-12-18 13:16:24 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-12-20 13:20:39 -0500 |
commit | 4c4d563b49830a66537c3f51070dad74d7a81d3a (patch) | |
tree | 85264314471e0e420e0226010044842191e20a79 | |
parent | ca3f257ae570c37d3da30a524a2f61ce602c6c99 (diff) |
KVM: VMX: Do not skip the instruction if handle_dr injects a fault
If kvm_get_dr or kvm_set_dr reports that it raised a fault, we must not
advance the instruction pointer. Otherwise the exception will hit the
wrong instruction.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/vmx.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 31eb5776d854..9cc54842ae14 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -5137,10 +5137,14 @@ static int handle_dr(struct kvm_vcpu *vcpu) | |||
5137 | reg = DEBUG_REG_ACCESS_REG(exit_qualification); | 5137 | reg = DEBUG_REG_ACCESS_REG(exit_qualification); |
5138 | if (exit_qualification & TYPE_MOV_FROM_DR) { | 5138 | if (exit_qualification & TYPE_MOV_FROM_DR) { |
5139 | unsigned long val; | 5139 | unsigned long val; |
5140 | if (!kvm_get_dr(vcpu, dr, &val)) | 5140 | |
5141 | kvm_register_write(vcpu, reg, val); | 5141 | if (kvm_get_dr(vcpu, dr, &val)) |
5142 | return 1; | ||
5143 | kvm_register_write(vcpu, reg, val); | ||
5142 | } else | 5144 | } else |
5143 | kvm_set_dr(vcpu, dr, vcpu->arch.regs[reg]); | 5145 | if (kvm_set_dr(vcpu, dr, vcpu->arch.regs[reg])) |
5146 | return 1; | ||
5147 | |||
5144 | skip_emulated_instruction(vcpu); | 5148 | skip_emulated_instruction(vcpu); |
5145 | return 1; | 5149 | return 1; |
5146 | } | 5150 | } |