]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU state
authorMarc Zyngier <maz@kernel.org>
Sun, 20 Jul 2025 10:22:29 +0000 (11:22 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Mon, 21 Jul 2025 16:34:57 +0000 (09:34 -0700)
commitc6e35dff58d348c1a9489e9b3b62b3721e62631d
treeea0e0e661af438fbbcc4cc7af2c942dcc1f942b0
parentefa1368ba9f4b6e081c0fdd73245b0ba6ef75bda
KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU state

Mark Brown reports that since we commit to making exceptions
visible without the vcpu being loaded, the external abort selftest
fails.

Upon investigation, it turns out that the code that makes registers
affected by an exception visible to the guest is completely broken
on VHE, as we don't check whether the system registers are loaded
on the CPU at this point. We managed to get away with this so far,
but that's obviously as bad as it gets,

Add the required checksm and document the absolute need to check
for the SYSREGS_ON_CPU flag before calling into any of the
__vcpu_write_sys_reg_to_cpu()__vcpu_read_sys_reg_from_cpu() helpers.

Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/18535df8-e647-4643-af9a-bb780af03a70@sirena.org.uk
Link: https://lore.kernel.org/r/20250720102229.179114-1-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/hyp/exception.c