KVM: x86/pmu: Reject userspace attempts to set reserved GLOBAL_STATUS bits
authorLike Xu <likexu@tencent.com>
Sat, 3 Jun 2023 01:10:49 +0000 (18:10 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 7 Jun 2023 00:31:44 +0000 (17:31 -0700)
commit30dab5c0b65ea580878f36d6ae7ff85f06813387
tree08f89e4e067e77a1aaae302d7f8bbdb14b2e4475
parent8de18543dfe34a6aac9deefb0256db2609cfa351
KVM: x86/pmu: Reject userspace attempts to set reserved GLOBAL_STATUS bits

Reject userspace writes to MSR_CORE_PERF_GLOBAL_STATUS that attempt to set
reserved bits.  Allowing userspace to stuff reserved bits doesn't harm KVM
itself, but it's architecturally wrong and the guest can't clear the
unsupported bits, e.g. makes the guest's PMI handler very confused.

Signed-off-by: Like Xu <likexu@tencent.com>
[sean: rewrite changelog to avoid use of #GP, rebase on name change]
Link: https://lore.kernel.org/r/20230603011058.1038821-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/pmu_intel.c