Skip to content

Commit bc2ca36

Browse files
committed
KVM: x86: Disallow changing MSR_PLATFORM_INFO after vCPU has run
Tag MSR_PLATFORM_INFO as a feature MSR (because it is), i.e. disallow it from being modified after the vCPU has run. To make KVM's selftest compliant, simply delete the userspace MSR write that restores KVM's original value at the end of the test. Verifying that userspace can write back what it originally read is uninteresting in this particular case, because KVM doesn't enforce _any_ bits in the MSR, i.e. userspace should be able to write any arbitrary value. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 2142ac6 commit bc2ca36

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ static const u32 msr_based_features_all_except_vmx[] = {
451451
MSR_IA32_UCODE_REV,
452452
MSR_IA32_ARCH_CAPABILITIES,
453453
MSR_IA32_PERF_CAPABILITIES,
454+
MSR_PLATFORM_INFO,
454455
};
455456

456457
static u32 msr_based_features[ARRAY_SIZE(msr_based_features_all_except_vmx) +

tools/testing/selftests/kvm/x86_64/platform_info_test.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ int main(int argc, char *argv[])
7272
}
7373

7474
done:
75-
vcpu_set_msr(vcpu, MSR_PLATFORM_INFO, msr_platform_info);
76-
7775
kvm_vm_free(vm);
7876

7977
return 0;

0 commit comments

Comments
 (0)