[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRZrTdgOagDSjrUO@google.com>
Date: Thu, 13 Nov 2025 15:35:41 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Vitaly Kuznetsov <vkuznets@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>, Wei Liu <wei.liu@...nel.org>,
Dexuan Cui <decui@...rosoft.com>, kvm@...r.kernel.org, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, Jim Mattson <jmattson@...gle.com>
Subject: Re: [PATCH 3/9] KVM: SVM: Add a helper to detect VMRUN failures
On Thu, Nov 13, 2025, Yosry Ahmed wrote:
> On Thu, Nov 13, 2025 at 02:56:15PM -0800, Sean Christopherson wrote:
> > Add a helper to detect VMRUN failures so that KVM can guard against its
> > own long-standing bug, where KVM neglects to set exitcode[63:32] when
> > synthesizing a nested VMFAIL_INVALID VM-Exit. This will allow fixing
> > KVM's mess of treating exitcode as two separate 32-bit values without
> > breaking KVM-on-KVM when running on an older, unfixed KVM.
> >
> > Cc: Jim Mattson <jmattson@...gle.com>
> > Cc: Yosry Ahmed <yosry.ahmed@...ux.dev>
> > Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> > ---
> > arch/x86/kvm/svm/nested.c | 16 +++++++---------
> > arch/x86/kvm/svm/svm.c | 4 ++--
> > arch/x86/kvm/svm/svm.h | 5 +++++
> > 3 files changed, 14 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> > index ba0f11c68372..8070e20ed5a7 100644
> > --- a/arch/x86/kvm/svm/nested.c
> > +++ b/arch/x86/kvm/svm/nested.c
> > @@ -1134,7 +1134,7 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
> > vmcb12->control.exit_info_1 = vmcb02->control.exit_info_1;
> > vmcb12->control.exit_info_2 = vmcb02->control.exit_info_2;
> >
> > - if (vmcb12->control.exit_code != SVM_EXIT_ERR)
> > + if (svm_is_vmrun_failure(vmcb12->control.exit_code))
>
> This was flipped, wasn't it?
Ugh, yes. Hrm, I'm surprised this wasn't caught by svm_nested_soft_inject_test.c.
Oof. We should probably also extend svm_is_vmrun_failure() (in the future) to
detect any failure, e.g. VMEXIT_INVALID_PMC might be relevant soon?
> > nested_save_pending_event_to_vmcb12(svm, vmcb12);
Powered by blists - more mailing lists