]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: respect singlestep when emulating instruction
authorFelipe Franciosi <felipe@nutanix.com>
Tue, 19 May 2020 08:11:22 +0000 (08:11 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Jun 2020 16:35:18 +0000 (12:35 -0400)
commit964d28d07cbe517e44698155450272cd1619abad
tree9f6acf93b84ce4a5867bc3c08f69507583b0549d
parent0d991f2d5caf69d8242618f90b4e4dd595787200
KVM: x86: respect singlestep when emulating instruction

When userspace configures KVM_GUESTDBG_SINGLESTEP, KVM will manage the
presence of X86_EFLAGS_TF via kvm_set/get_rflags on vcpus. The actual
rflag bit is therefore hidden from callers.

That includes init_emulate_ctxt() which uses the value returned from
kvm_get_flags() to set ctxt->tf. As a result, x86_emulate_instruction()
will skip a single step, leaving singlestep_rip stale and not returning
to userspace.

This resolves the issue by observing the vcpu guest_debug configuration
alongside ctxt->tf in x86_emulate_instruction(), performing the single
step if set.

Cc: stable@vger.kernel.org
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Message-Id: <20200519081048.8204-1-felipe@nutanix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c