acrn-kernel/arch/x86/kvm
Mingwei Zhang 3863ca0522 KVM: x86/pmu: Fix type length error when reading pmu->fixed_ctr_ctrl
commit 05519c86d6997cfb9bb6c82ce1595d1015b718dc 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>
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
Kconfig
Makefile
cpuid.c KVM: x86: Constrain guest-supported xfeatures only at KVM_GET_XSAVE{2} 2023-10-25 12:03:04 +02:00
cpuid.h
debugfs.c
emulate.c
fpu.h
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
i8254.c
i8254.h
i8259.c
ioapic.c
ioapic.h
irq.c
irq.h
irq_comm.c
kvm-asm-offsets.c
kvm_cache_regs.h
kvm_emulate.h
kvm_onhyperv.c
kvm_onhyperv.h
lapic.c KVM: x86: Fix lapic timer interrupt lost after loading a snapshot. 2023-12-08 08:51:18 +01:00
lapic.h
mmu.h
mtrr.c
pmu.c
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
tss.h
x86.c KVM: x86: Ignore MSR_AMD64_TW_CFG access 2023-11-28 17:07:08 +00:00
x86.h
xen.c
xen.h