summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorNadav Amit2014-11-02 10:54:53 +0100
committerPaolo Bonzini2014-11-07 15:44:08 +0100
commit38827dbd3fb85a94a002fcf67b8735d5bc1a7e1a (patch)
tree8d92ad6b0a3bd075a81c8a311d8e5581fd0a17f7 /arch/x86/kvm/x86.c
parentKVM: x86: MOV to CR3 can set bit 63 (diff)
downloadkernel-qcow2-linux-38827dbd3fb85a94a002fcf67b8735d5bc1a7e1a.tar.gz
kernel-qcow2-linux-38827dbd3fb85a94a002fcf67b8735d5bc1a7e1a.tar.xz
kernel-qcow2-linux-38827dbd3fb85a94a002fcf67b8735d5bc1a7e1a.zip
KVM: x86: Do not update EFLAGS on faulting emulation
If the emulation ends in fault, eflags should not be updated. However, several instruction emulations (actually all the fastops) currently update eflags, if the fault was detected afterwards (e.g., #PF during writeback). Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 641358865a0c..da1591eeb477 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5360,7 +5360,9 @@ restart:
kvm_rip_write(vcpu, ctxt->eip);
if (r == EMULATE_DONE)
kvm_vcpu_check_singlestep(vcpu, rflags, &r);
- __kvm_set_rflags(vcpu, ctxt->eflags);
+ if (!ctxt->have_exception ||
+ exception_type(ctxt->exception.vector) == EXCPT_TRAP)
+ __kvm_set_rflags(vcpu, ctxt->eflags);
/*
* For STI, interrupts are shadowed; so KVM_REQ_EVENT will