Re: [PATCH v6 01/16] KVM: nSVM: Stop leaking single-stepping on VMRUN into L2
From: Yosry Ahmed
Date: Fri May 22 2026 - 19:46:23 EST
On Fri, May 22, 2026 at 4:45 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>
> On Fri, May 22, 2026 at 4:10 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> >
> > On Wed, May 06, 2026, Yosry Ahmed wrote:
> > > According to the APM, TF on VMRUN causes a #DB after VMRUN completes on
> > > the _host_ side. However, KVM injects a #DB in L2 context instead (or
> > > exits to userspace if KVM_GUESTDBG_SINGLESTEP is set) in
> > > kvm_skip_emulated_instruction().
> > >
> > > Introduce __kvm_skip_emulated_instruction(),
> >
> > Eh, just make svm_skip_emulated_instruction() visible via svm.h and call that
> > directly. No need to bring SVM's mess into common KVM.
>
> Yeah I thought about doing that. The only reason I was hesitant is
> that if [__]kvm_skip_emulated_instruction(),
if [__]kvm_skip_emulated_instruction() gains new logic*
> handling it here might be
> missed. Also, there's only one direct caller of
> svm/vmx_skip_emulated_instruction() (and it's TASK_SWITCH
> interception, who cares).
>
> So I think it's more consistent and future proof to refactor
> kvm_skip_emulated_instruction() instead.
>
> All that being said, I don't feel strongly, up to you.