On Tue, Aug 27, 2019 at 12:12:51PM -0700, Jim Mattson wrote: > On Fri, Aug 23, 2019 at 1:55 PM Sean Christopherson > <sean.j.christopherson@xxxxxxxxx> wrote: > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -6611,12 +6611,13 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, > > unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); > > toggle_interruptibility(vcpu, ctxt->interruptibility); > > vcpu->arch.emulate_regs_need_sync_to_vcpu = false; > > - kvm_rip_write(vcpu, ctxt->eip); > > - if (r == EMULATE_DONE && ctxt->tf) > > - kvm_vcpu_do_singlestep(vcpu, &r); > > if (!ctxt->have_exception || > > - exception_type(ctxt->exception.vector) == EXCPT_TRAP) > > + exception_type(ctxt->exception.vector) == EXCPT_TRAP) { > > NYC, but... > > I don't think this check for "exception_type" is quite right. A > general detect fault (which can be synthesized by check_dr_read) is > mischaracterized by exception_type() as a trap. Or maybe I'm missing > something? (I often am.) Pretty sure you're not missing anything. And while we're poking holes in #DB emulation, int1/icebp isn't emulated correctly as it should be reinjected with INTR_TYPE_PRIV_SW_EXCEPTION, not as a INTR_TYPE_HARD_EXCEPTION. The CPU automically clears DR7.GD on #DB, unless the #DB is due to int1...