From: Sean Christopherson <seanjc@google.com>
To: Yosry Ahmed <yosry@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
xinyang@anthropic.com, stable@vger.kernel.org
Subject: Re: [PATCH 2/5] KVM: SVM: check validity of VMCB when returning from SMM
Date: Tue, 10 Mar 2026 14:45:39 -0700 [thread overview]
Message-ID: <abCRA_B2kHp6T7Zn@google.com> (raw)
In-Reply-To: <CAO9r8zOLc030xTsnkYWvp5yUtnzQgVZnXXhvKZWC__1wRSP61A@mail.gmail.com>
On Tue, Mar 10, 2026, Yosry Ahmed wrote:
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > arch/x86/kvm/svm/nested.c | 12 ++++++++++--
> > arch/x86/kvm/svm/svm.c | 4 ++++
> > arch/x86/kvm/svm/svm.h | 1 +
> > 3 files changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> > index 7b61124051a7..de9906adb73b 100644
> > --- a/arch/x86/kvm/svm/nested.c
> > +++ b/arch/x86/kvm/svm/nested.c
> > @@ -419,6 +419,15 @@ static bool nested_vmcb_check_controls(struct kvm_vcpu *vcpu)
> > return __nested_vmcb_check_controls(vcpu, ctl);
> > }
> >
> > +int nested_svm_check_cached_vmcb12(struct kvm_vcpu *vcpu)
> > +{
> > + if (!nested_vmcb_check_save(vcpu) ||
> > + !nested_vmcb_check_controls(vcpu))
> > + return -EINVAL;
> > +
> > + return 0;
> > +}
>
> Nit: if we make this a boolean we could just do:
>
> bool nested_svm_check_cached_vmcb12(struct kvm_vcpu *vcpu)
> {
> return nested_vmcb_check_save(vcpu) && nested_vmcb_check_controls(vcpu);
I don't care one way or the other for this particular patch, but once the dust
settles on nSVM (assuming it ever does) I do think we should align the "nested
check" return types across nVMX and nSVM (which is likely why Paolo ended up with
the above; I requested using -EINVAL for the nVMXx) patch.
My fairly strong preference is to use 0/-errno as "return -EINVAL" is more
obviously an error than "return true". But we can bikeshed later :-)
next prev parent reply other threads:[~2026-03-10 21:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260310202414.406078-1-pbonzini@redhat.com>
2026-03-10 20:24 ` [PATCH 1/5] KVM: VMX: check validity of VMCS controls when returning from SMM Paolo Bonzini
2026-03-10 20:24 ` [PATCH 2/5] KVM: SVM: check validity of VMCB " Paolo Bonzini
2026-03-10 21:37 ` Yosry Ahmed
2026-03-10 21:45 ` Sean Christopherson [this message]
2026-03-10 21:46 ` Yosry Ahmed
2026-03-11 16:53 ` Paolo Bonzini
2026-03-10 20:24 ` [PATCH 3/5] selftests: kvm: extract common functionality out of smm_test.c Paolo Bonzini
2026-03-10 20:24 ` [PATCH 4/5] selftests: kvm: add a test that VMX validates controls on RSM Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=abCRA_B2kHp6T7Zn@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
--cc=xinyang@anthropic.com \
--cc=yosry@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox