]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/pmu: Limit the maximum number of supported Intel GP counters
authorLike Xu <likexu@tencent.com>
Mon, 19 Sep 2022 09:10:07 +0000 (17:10 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 9 Nov 2022 17:26:53 +0000 (12:26 -0500)
commitfc68fc3118baa696d1eea1162f70d25c40b1c4c7
tree33694713af974b32bbabdc99abe94e39b64dfd65
parent95217576302ecd3a9d835d4e8d60c140611cc823
KVM: x86/pmu: Limit the maximum number of supported Intel GP counters

The Intel Architectural IA32_PMCx MSRs addresses range allows for a
maximum of 8 GP counters, and KVM cannot address any more.  Introduce a
local macro (named KVM_INTEL_PMC_MAX_GENERIC) and use it consistently to
refer to the number of counters supported by KVM, thus avoiding possible
out-of-bound accesses.

Suggested-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Like Xu <likexu@tencent.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220919091008.60695-2-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/pmu.c
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/x86.c