]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Warn if accessing timer pending state outside of vcpu context
authorMarc Zyngier <maz@kernel.org>
Tue, 7 Jun 2022 13:14:27 +0000 (14:14 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 8 Jun 2022 09:16:23 +0000 (10:16 +0100)
commit6a6b3aeeb09f3735254a78b1fb85633b5857a221
tree0af5d3633924ced2ad9a6fd983b306dc75764763
parent4e77a6424cb8193610a8d36ca899b2b180835420
KVM: arm64: Warn if accessing timer pending state outside of vcpu context

A recurrent bug in the KVM/arm64 code base consists in trying to
access the timer pending state outside of the vcpu context, which
makes zero sense (the pending state only exists when the vcpu
is loaded).

In order to avoid more embarassing crashes and catch the offenders
red-handed, add a warning to kvm_arch_timer_get_input_level() and
return the state as non-pending. This avoids taking the system down,
and still helps tracking down silly bugs.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220607131427.1164881-4-maz@kernel.org
arch/arm64/kvm/arch_timer.c