linux/arch/x86/kvm
Mingwei Zhang 3863ca0522 KVM: x86/pmu: Fix type length error when reading pmu->fixed_ctr_ctrl
commit 05519c86d6 upstream.

Use a u64 instead of a u8 when taking a snapshot of pmu->fixed_ctr_ctrl
when reprogramming fixed counters, as truncating the value results in KVM
thinking fixed counter 2 is already disabled (the bug also affects fixed
counters 3+, but KVM doesn't yet support those).  As a result, if the
guest disables fixed counter 2, KVM will get a false negative and fail to
reprogram/disable emulation of the counter, which can leads to incorrect
counts and spurious PMIs in the guest.

Fixes: 76d287b234 ("KVM: x86/pmu: Drop "u8 ctrl, int idx" for reprogram_fixed_counter()")
Cc: stable@vger.kernel.org
Signed-off-by: Mingwei Zhang <mizhang@google.com>
Link: https://lore.kernel.org/r/20240123221220.3911317-1-mizhang@google.com
[sean: rewrite changelog to call out the effects of the bug]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2024-02-23 09:12:43 +01:00
..
mmu KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously 2023-10-25 12:03:14 +02:00
svm work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
vmx KVM: x86/pmu: Fix type length error when reading pmu->fixed_ctr_ctrl 2024-02-23 09:12:43 +01:00
.gitignore KVM: x86: use a separate asm-offsets.c file 2022-11-09 12:10:17 -05:00
cpuid.c KVM: x86: Constrain guest-supported xfeatures only at KVM_GET_XSAVE{2} 2023-10-25 12:03:04 +02:00
cpuid.h KVM: x86: Add dedicated helper to get CPUID entry with significant index 2022-07-14 11:38:32 -04:00
debugfs.c KVM: x86: Reduce refcount if single_open() fails in kvm_mmu_rmaps_stat_open() 2022-10-27 04:41:54 -04:00
emulate.c KVM: x86: smm: number of GPRs in the SMRAM image depends on the image format 2022-10-28 06:10:30 -04:00
fpu.h KVM: x86: Move FPU register accessors into fpu.h 2021-06-17 13:09:24 -04:00
hyperv.c KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space 2023-11-28 17:07:08 +00:00
hyperv.h KVM: x86: Report error when setting CPUID if Hyper-V allocation fails 2022-09-26 12:02:39 -04:00
i8254.c KVM: x86: PIT: Preserve state of speaker port data bit 2022-06-08 13:06:20 -04:00
i8254.h KVM: x86: PIT: Preserve state of speaker port data bit 2022-06-08 13:06:20 -04:00
i8259.c KVM: x86/i8259: Remove a dead store of irq in a conditional block 2022-04-02 05:41:19 -04:00
ioapic.c KVM: x86/ioapic: Remove unused "addr" and "length" of ioapic_read_indirect() 2022-02-10 13:47:13 -05:00
ioapic.h x86/kvm: remove unused ack_notifier callbacks 2021-11-18 07:05:57 -05:00
irq.c KVM: x86/xen: handle PV timers oneshot mode 2022-04-02 05:41:16 -04:00
irq.h x86/kvm: remove unused ack_notifier callbacks 2021-11-18 07:05:57 -05:00
irq_comm.c KVM: x86/xen: Make kvm_xen_set_evtchn() reusable from other places 2022-04-02 05:41:14 -04:00
Kconfig KVM: x86: Select CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL 2022-09-29 10:23:08 +01:00
kvm-asm-offsets.c KVM: SVM: move MSR_IA32_SPEC_CTRL save/restore to assembly 2022-11-09 12:25:53 -05:00
kvm_cache_regs.h KVM: VMX: Make CR0.WP a guest owned bit 2023-05-17 11:53:29 +02:00
kvm_emulate.h KVM: x86: Bug the VM if the emulator accesses a non-existent GPR 2022-06-10 10:01:33 -04:00
kvm_onhyperv.c KVM: x86: Uninline and export hv_track_root_tdp() 2022-02-10 13:47:19 -05:00
kvm_onhyperv.h KVM: SVM: Flush Hyper-V TLB when required 2023-04-20 12:35:12 +02:00
lapic.c KVM: x86: Fix lapic timer interrupt lost after loading a snapshot. 2023-12-08 08:51:18 +01:00
lapic.h KVM: x86: Rename kvm_apic_has_events() to make it INIT/SIPI specific 2022-09-26 12:37:18 -04:00
Makefile KVM: SVM: replace regs argument of __svm_vcpu_run() with vcpu_svm 2022-11-09 12:16:34 -05:00
mmu.h KVM: x86/mmu: Refresh CR0.WP prior to checking for emulated permission faults 2023-05-17 11:53:30 +02:00
mtrr.c KVM: x86: Add helper to consolidate "raw" reserved GPA mask calculations 2021-02-04 09:27:30 -05:00
pmu.c KVM: x86: Make use of kvm_read_cr*_bits() when testing bits 2023-05-17 11:53:29 +02:00
pmu.h KVM: x86/pmu: Truncate counter value to allowed width on write 2023-11-02 09:35:21 +01:00
reverse_cpuid.h x86/cpu, kvm: Add support for CPUID_80000021_EAX 2023-08-08 20:03:50 +02:00
trace.h KVM: x86: Print guest pgd in kvm_nested_vmenter() 2022-09-26 12:02:33 -04:00
tss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
x86.c KVM: x86: Ignore MSR_AMD64_TW_CFG access 2023-11-28 17:07:08 +00:00
x86.h KVM: x86: Track supported PERF_CAPABILITIES in kvm_caps 2023-05-17 11:53:27 +02:00
xen.c KVM: x86: fix deadlock for KVM_XEN_EVTCHN_RESET 2023-02-25 11:25:40 +01:00
xen.h KVM: x86: do not set st->preempted when going back to user space 2022-06-08 04:21:06 -04:00