Skip to content

Commit 555485b

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86: Fully re-initialize supported_mce_cap on vendor module load
Effectively reset supported_mce_cap on vendor module load to ensure that capabilities aren't unintentionally preserved across module reload, e.g. if kvm-intel.ko added a module param to control LMCE support, or if someone somehow managed to load a vendor module that doesn't support LMCE after loading and unloading kvm-intel.ko. Practically speaking, this bug is a non-issue as kvm-intel.ko doesn't have a module param for LMCE, and there is no system in the world that supports both kvm-intel.ko and kvm-amd.ko. Fixes: c45dcc7 ("KVM: VMX: enable guest access to LMCE related MSRs") Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Xiaoyao Li <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent c43ad19 commit 555485b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@
9292
#define MAX_IO_MSRS 256
9393
#define KVM_MAX_MCE_BANKS 32
9494

95-
struct kvm_caps kvm_caps __read_mostly = {
96-
.supported_mce_cap = MCG_CTL_P | MCG_SER_P,
97-
};
95+
struct kvm_caps kvm_caps __read_mostly;
9896
EXPORT_SYMBOL_GPL(kvm_caps);
9997

10098
#define ERR_PTR_USR(e) ((void __user *)ERR_PTR(e))
@@ -9776,6 +9774,7 @@ int kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
97769774
goto out_free_percpu;
97779775

97789776
kvm_caps.supported_vm_types = BIT(KVM_X86_DEFAULT_VM);
9777+
kvm_caps.supported_mce_cap = MCG_CTL_P | MCG_SER_P;
97799778

97809779
if (boot_cpu_has(X86_FEATURE_XSAVE)) {
97819780
host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);

0 commit comments

Comments
 (0)