From: Sean Christopherson <seanjc@google.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Mathias Krause <minipli@grsecurity.net>,
John Allen <john.allen@amd.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Chao Gao <chao.gao@intel.com>,
Binbin Wu <binbin.wu@linux.intel.com>,
Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH v2 2/3] KVM: x86: Harden against unexpected adjustments to kvm_cpu_caps
Date: Thu, 29 Jan 2026 07:12:01 -0800 [thread overview]
Message-ID: <aXt4wf6Vpo5da2rc@google.com> (raw)
In-Reply-To: <7f045418-6ce4-4f2f-a3ee-4ddc3cf2fda5@intel.com>
On Thu, Jan 29, 2026, Xiaoyao Li wrote:
> On 1/28/2026 9:43 AM, Sean Christopherson wrote:
> > Add a flag to track when KVM is actively configuring its CPU caps, and
> > WARN if a cap is set or cleared if KVM isn't in its configuration stage.
> > Modifying CPU caps after {svm,vmx}_set_cpu_caps() can be fatal to KVM, as
> > vendor setup code expects the CPU caps to be frozen at that point, e.g.
> > will do additional configuration based on the caps.
> >
> > Rename kvm_set_cpu_caps() to kvm_initialize_cpu_caps() to pair with the
> > new "finalize", and to make it more obvious that KVM's CPU caps aren't
> > fully configured within the function.
> >
> > Signed-off-by: Sean Christopherson <seanjc@google.com>
> > ---
> > arch/x86/kvm/cpuid.c | 10 ++++++++--
> > arch/x86/kvm/cpuid.h | 12 +++++++++++-
> > arch/x86/kvm/svm/svm.c | 4 +++-
> > arch/x86/kvm/vmx/vmx.c | 4 +++-
> > 4 files changed, 25 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> > index 575244af9c9f..7fe4e58a6ebf 100644
> > --- a/arch/x86/kvm/cpuid.c
> > +++ b/arch/x86/kvm/cpuid.c
> > @@ -36,6 +36,9 @@
> > u32 kvm_cpu_caps[NR_KVM_CPU_CAPS] __read_mostly;
> > EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_cpu_caps);
> > +bool kvm_is_configuring_cpu_caps __read_mostly;
>
> I prefer the name, kvm_cpu_caps_finalized. But not strongly, so
"finalized" reads too much like the helper queries if the caps are already
finalized, i.e. like an accessor.
next prev parent reply other threads:[~2026-01-29 15:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 1:43 [PATCH v2 0/3] KVM: x86: CET vs. nVMX fix and hardening Sean Christopherson
2026-01-28 1:43 ` [PATCH v2 1/3] KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps() Sean Christopherson
2026-01-29 2:55 ` Xiaoyao Li
2026-01-29 15:03 ` Sean Christopherson
2026-01-29 7:34 ` Binbin Wu
2026-01-30 3:23 ` Xiaoyao Li
2026-01-30 5:06 ` Binbin Wu
2026-01-30 8:56 ` Binbin Wu
2026-01-28 1:43 ` [PATCH v2 2/3] KVM: x86: Harden against unexpected adjustments to kvm_cpu_caps Sean Christopherson
2026-01-29 3:09 ` Xiaoyao Li
2026-01-29 15:12 ` Sean Christopherson [this message]
2026-01-30 3:01 ` Xiaoyao Li
2026-01-30 8:59 ` Binbin Wu
2026-01-28 1:43 ` [PATCH v2 3/3] KVM: VMX: Print out "bad" offsets+value on VMCS config mismatch Sean Christopherson
2026-01-29 3:16 ` Xiaoyao Li
2026-01-30 9:17 ` Binbin Wu
2026-02-04 0:10 ` [PATCH v2 0/3] KVM: x86: CET vs. nVMX fix and hardening Sean Christopherson
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=aXt4wf6Vpo5da2rc@google.com \
--to=seanjc@google.com \
--cc=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=jmattson@google.com \
--cc=john.allen@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@grsecurity.net \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=xiaoyao.li@intel.com \
/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