Commit f8ade83
committed
KVM: x86: Explicitly configure supported XSS from {svm,vmx}_set_cpu_caps()
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.
Note, kvm_caps.supported_{xcr0,xss} are unconditionally initialized by
kvm_x86_vendor_init(), before calling into vendor code, and not referenced
between ops->hardware_setup() and their current/old location.
Fixes: 69cc3e8 ("KVM: x86: Add XSS support for CET_KERNEL and CET_USER")
Cc: stable@vger.kernel.org
Cc: Mathias Krause <minipli@grsecurity.net>
Cc: John Allen <john.allen@amd.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Chao Gao <chao.gao@intel.com>
Cc: Binbin Wu <binbin.wu@linux.intel.com>
Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Link: https://patch.msgid.link/20260128014310.3255561-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent e396a74 commit f8ade83
4 files changed
+23
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5284 | 5284 | | |
5285 | 5285 | | |
5286 | 5286 | | |
| 5287 | + | |
| 5288 | + | |
5287 | 5289 | | |
5288 | 5290 | | |
5289 | 5291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8051 | 8051 | | |
8052 | 8052 | | |
8053 | 8053 | | |
| 8054 | + | |
| 8055 | + | |
8054 | 8056 | | |
8055 | 8057 | | |
8056 | 8058 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9953 | 9953 | | |
9954 | 9954 | | |
9955 | 9955 | | |
| 9956 | + | |
| 9957 | + | |
| 9958 | + | |
| 9959 | + | |
| 9960 | + | |
| 9961 | + | |
| 9962 | + | |
| 9963 | + | |
| 9964 | + | |
| 9965 | + | |
| 9966 | + | |
| 9967 | + | |
| 9968 | + | |
| 9969 | + | |
| 9970 | + | |
| 9971 | + | |
| 9972 | + | |
9956 | 9973 | | |
9957 | 9974 | | |
9958 | 9975 | | |
| |||
10125 | 10142 | | |
10126 | 10143 | | |
10127 | 10144 | | |
10128 | | - | |
10129 | | - | |
10130 | | - | |
10131 | | - | |
10132 | | - | |
10133 | | - | |
10134 | | - | |
10135 | | - | |
10136 | | - | |
10137 | | - | |
10138 | | - | |
10139 | | - | |
10140 | | - | |
10141 | 10145 | | |
10142 | 10146 | | |
10143 | 10147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
| 474 | + | |
| 475 | + | |
474 | 476 | | |
475 | 477 | | |
476 | 478 | | |
| |||
0 commit comments