]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: arm64: Convert timer offset VA when accessed in HYP code
authorMarc Zyngier <maz@kernel.org>
Wed, 12 Feb 2025 17:34:54 +0000 (17:34 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 13 Feb 2025 17:55:13 +0000 (17:55 +0000)
commit65729da9ce37f5a2c62e2542ef03bc9ac6775a7d
tree3a63dee64a913d3b054f95acfe0677ad425718dd
parent332b7e6d62b7a3a988017f5184e547aa20e3a19a
KVM: arm64: Convert timer offset VA when accessed in HYP code

Now that EL2 has gained some early timer emulation, it accesses
the offsets pointed to by the timer structure, both of which
live in the KVM structure.

Of course, these are *kernel* pointers, so the dereferencing
of these pointers in non-kernel code must be itself be offset.

Given switch.h its own version of timer_get_offset() and use that
instead.

Fixes: b86fc215dc26d ("KVM: arm64: Handle counter access early in non-HYP context")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Link: https://lore.kernel.org/r/20250212173454.2864462-1-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/include/hyp/switch.h