Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1531758

Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in skip_emulated_instruction

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in skip_emulated_instruction
Date 2016-11-28 23:50 +0100
Message-ID <sICUh-8cJ-5@gated-at.bofh.it> (permalink)
References (1 earlier) <sIlJM-5y0-19@gated-at.bofh.it> <sIsBA-1xz-33@gated-at.bofh.it> <sIwOR-4kz-25@gated-at.bofh.it> <sIxUC-52k-49@gated-at.bofh.it> <sIz0n-5MH-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 28/11/2016 19:34, Kyle Huey wrote:
>> > The Intel manual says "The processor clears the TF flag before calling
>> > the exception handler" (17.3.1.4), so I think you should do it too.
> The processor does this automatically. "When accessing an exception or
> interrupt handler through either an interrupt gate or a trap gate, the
> processor clears the TF flag in the EFLAGS register after it saves the
> contents of the EFLAGS register on the stack." (Vol 3, 6.12.1.2)
> Empirically, this holds when injecting an exception on VM entry. If
> you take the x86/debug.c test from kvm-unit-tests and inspect RFLAGS
> in handle_db (not regs->rflags, but the actual RFLAGS register while
> running the exception handler) the TF is clear. And, if you modify my
> patch to clear TF before returning, the single stepping ceases after
> the CPUID instruction because the TF was in fact cleared for good.

Ok, then that would be a bug in kvm_vcpu_check_singlestep (because
kvm_vcpu_check_singlestep is mostly interesting for real mode emulation,
I checked kvm_inject_realmode_interrupt and it clears TF too, in
__emulate_int_real).

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] KVM: VMX: Fix single stepping with emulated instructions. Kyle Huey <me@kylehuey.com> - 2016-11-28 05:20 +0100
  [PATCH 4/5] KVM: x86: Add a return value to skip_emulated_instruction and propagate it. Kyle Huey <me@kylehuey.com> - 2016-11-28 05:20 +0100
  [PATCH 2/5] KVM: VMX: Reorder some skip_emulated_instruction calls Kyle Huey <me@kylehuey.com> - 2016-11-28 05:30 +0100
  [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in skip_emulated_instruction Kyle Huey <me@kylehuey.com> - 2016-11-28 05:30 +0100
    Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in  skip_emulated_instruction Paolo Bonzini <pbonzini@redhat.com> - 2016-11-28 12:50 +0100
      Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in skip_emulated_instruction Kyle Huey <me@kylehuey.com> - 2016-11-28 17:20 +0100
        Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in  skip_emulated_instruction Paolo Bonzini <pbonzini@redhat.com> - 2016-11-28 18:30 +0100
          Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in skip_emulated_instruction Kyle Huey <me@kylehuey.com> - 2016-11-28 19:40 +0100
            Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in  skip_emulated_instruction Paolo Bonzini <pbonzini@redhat.com> - 2016-11-28 23:50 +0100
  [PATCH 3/5] KVM: VMX: Move skip_emulated_instruction out of nested_vmx_check_vmcs12 Kyle Huey <me@kylehuey.com> - 2016-11-28 05:30 +0100
  [PATCH 1/5] KVM: x86: Add a return value to kvm_emulate_cpuid Kyle Huey <me@kylehuey.com> - 2016-11-28 05:30 +0100

csiph-web