]> Git Repo - linux.git/commitdiff
KVM: x86: Do not update EFLAGS on faulting emulation
authorNadav Amit <[email protected]>
Sun, 2 Nov 2014 09:54:53 +0000 (11:54 +0200)
committerPaolo Bonzini <[email protected]>
Fri, 7 Nov 2014 14:44:08 +0000 (15:44 +0100)
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 <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
arch/x86/kvm/x86.c

index 641358865a0c98068c6c2a6f446e02fdcafd444d..da1591eeb4773e58ba476fd6c4c5e0c1a613e4db 100644 (file)
@@ -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
This page took 0.065773 seconds and 4 git commands to generate.