1
0
Fork 0
alistair23-linux/arch/arm64/kvm
Marc Zyngier c5fe50e18f KVM: arm64: Don't access PMCR_EL0 when no PMU is available
commit 2a5f1b67ec upstream.

We reset the guest's view of PMCR_EL0 unconditionally, based on
the host's view of this register. It is however legal for an
implementation not to provide any PMU, resulting in an UNDEF.

The obvious fix is to skip the reset of this shadow register
when no PMU is available, sidestepping the issue entirely.
If no PMU is available, the guest is not able to request
a virtual PMU anyway, so not doing nothing is the right thing
to do!

It is unlikely that this bug can hit any HW implementation
though, as they all provide a PMU. It has been found using nested
virt with the host KVM not implementing the PMU itself.

Fixes: ab9468340d ("arm64: KVM: Add access handler for PMCR register")
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201210083059.1277162-1-maz@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-17 14:05:38 +01:00
..
hyp KVM: arm64: Assume write fault on S1PTW permission fault on instruction fetch 2020-10-01 13:18:25 +02:00
Kconfig Make anon_inodes unconditional 2019-04-19 14:03:11 +02:00
Makefile arm64: KVM: Add accessors to track guest/host only counters 2019-04-24 15:35:30 +01:00
debug.c KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE 2020-02-01 09:34:52 +00:00
fpsimd.c arm64/fpsimd: Introduce fpsimd_save_and_flush_cpu_state() and use it 2019-06-04 13:17:30 +01:00
guest.c KVM: arm64: Fix 32bit PC wrap-around 2020-05-14 07:58:26 +02:00
handle_exit.c KVM: arm64: Save the host's PtrAuth keys in non-preemptible context 2020-06-17 16:40:38 +02:00
hyp-init.S KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART 2020-07-16 08:16:43 +02:00
hyp.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
inject_fault.c KVM: arm64: Correct PSTATE on exception entry 2020-02-11 04:35:16 -08:00
irq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
pmu.c KVM: arm64: Move pmu hyp code under hyp's Makefile to avoid instrumentation 2019-05-24 14:53:20 +01:00
regmap.c arm64: KVM: regmap: Fix unexpected switch fall-through 2019-07-26 15:33:41 +01:00
reset.c KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect with SVE 2020-07-16 08:16:44 +02:00
sys_regs.c KVM: arm64: Don't access PMCR_EL0 when no PMU is available 2021-01-17 14:05:38 +01:00
sys_regs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
sys_regs_generic_v8.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
trace.h arm64: KVM: Add trapped system register access tracepoint 2018-12-19 17:47:08 +00:00
va_layout.c arm64: mm: Introduce vabits_actual 2019-08-09 11:17:21 +01:00
vgic-sys-reg-v3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00