From: Binbin Wu <binbin.wu@linux.intel.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Sean Christopherson <seanjc@google.com>,
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>, Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH v2 1/3] KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps()
Date: Fri, 30 Jan 2026 13:06:54 +0800 [thread overview]
Message-ID: <ccad59aa-d1b0-475a-a838-e705d7dc446a@linux.intel.com> (raw)
In-Reply-To: <e4e52215-3160-4f67-877b-16b9d6cba210@intel.com>
On 1/30/2026 11:23 AM, Xiaoyao Li wrote:
> On 1/29/2026 3:34 PM, Binbin Wu wrote:
>>
>>
>> On 1/28/2026 9:43 AM, Sean Christopherson wrote:
>>> Explicitly configure KVM's supported XSS as part of each vendor's setup
>>> flow to fix a bug where clearing SHSTK and IBT in kvm_cpu_caps, e.g. due
>>> to lack of CET XFEATURE support, makes kvm-intel.ko unloadable when nested
>>> VMX is enabled, i.e. when nested=1. The late clearing results in
>>> nested_vmx_setup_{entry,exit}_ctls() clearing VM_{ENTRY,EXIT}_LOAD_CET_STATE
>>> when nested_vmx_setup_ctls_msrs() runs during the CPU compatibility checks,
>>> ultimately leading to a mismatched VMCS config due to the reference config
>>> having the CET bits set, but every CPU's "local" config having the bits
>>> cleared.
>>
>> A bit confuse about the description.
>>
>> Before this patch:
>>
>> kvm_x86_vendor_init
>> | vmx_hardware_setup
>> | nested_vmx_hardware_setup
>> | nested_vmx_setup_ctls_msrs
>> | ...
>> | for_each_online_cpu(cpu)
>> | smp_call_function_single(cpu, kvm_x86_check_cpu_compat, &r, 1)
>> | | kvm_x86_check_processor_compatibility
>> | | kvm_x86_call(check_processor_compatibility)()
>> | | vmx_check_processor_compatibility
>> | | setup_vmcs_config
>> | | nested_vmx_setup_ctls_msrs
>> | ...
>> | //late clearing of SHSTK and IBT
>>
>> If we don't consider CPU hotplug case, both the setup of reference VMCS and the
>> local config are before the late clearing of SHSTK and IBT. They should be
>> consistent.
>>
>> So you are referring the mismatch situation during CPU hotplug?
>
> I guess it's triggered the path
>
> kvm_init()
> kvm_init_virtualization()
> kvm_enable_virtualization()
> cpuhp_setup_state()
> kvm_online_cpu()
> ...
>
> (note, it requires enable_virt_at_load to be true)
>
> which is after
> vmx_init()
> kvm_x86_vendor_init()
>
Oh, right.
Forgot about that by default KVM enables virtualization when KVM is loaded,
which trigger the cpuhp framework to do per-CPU enabling.
Thanks!
next prev parent reply other threads:[~2026-01-30 5:06 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 [this message]
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
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=ccad59aa-d1b0-475a-a838-e705d7dc446a@linux.intel.com \
--to=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=seanjc@google.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