linux/arch/arm64/kvm/hyp
Marc Zyngier a3aa4850b3 KVM: arm64: Use shadow SPSR_EL1 when injecting exceptions on !VHE
commit 278583055a upstream.

Injecting an exception into a guest with non-VHE is risky business.
Instead of writing in the shadow register for the switch code to
restore it, we override the CPU register instead. Which gets
overriden a few instructions later by said restore code.

The result is that although the guest correctly gets the exception,
it will return to the original context in some random state,
depending on what was there the first place... Boo.

Fix the issue by writing to the shadow register. The original code
is absolutely fine on VHE, as the state is already loaded, and writing
to the shadow register in that case would actually be a bug.

Fixes: bb666c472c ("KVM: arm64: Inject AArch64 exceptions from HYP")
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20220121184207.423426-1-maz@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-01 17:26:59 +01:00
..
include KVM: arm64: Save PSTATE early on exit 2021-12-17 10:30:14 +01:00
nvhe KVM: arm64: Fix host stage-2 finalization 2021-11-25 09:48:32 +01:00
vhe Merge branch kvm-arm64/pkvm-fixed-features-prologue into kvmarm-master/next 2021-08-20 12:23:53 +01:00
aarch32.c KVM: arm64: Move kvm_vcpu_trap_il_is32bit into kvm_skip_instr32() 2020-11-10 08:34:24 +00:00
entry.S KVM: arm64: Save/restore MTE registers 2021-06-22 14:08:05 +01:00
exception.c KVM: arm64: Use shadow SPSR_EL1 when injecting exceptions on !VHE 2022-02-01 17:26:59 +01:00
fpsimd.S KVM: arm64: Rework SVE host-save/guest-restore 2021-03-18 13:57:37 +00:00
hyp-entry.S KVM: arm64: Extract ESR_ELx.EC only 2021-11-18 19:16:02 +01:00
Makefile KVM: arm64: Prepare the creation of s1 mappings at EL2 2021-03-19 12:01:21 +00:00
pgtable.c KVM: arm64: Enable retrieving protections attributes of PTEs 2021-08-11 11:39:51 +01:00
reserved_mem.c memblock: make memblock_find_in_range method private 2021-09-03 09:58:17 -07:00
vgic-v2-cpuif-proxy.c KVM: arm64: Remove hyp_symbol_addr 2021-01-23 14:01:00 +00:00
vgic-v3-sr.c KVM: arm64: Fix CPU interface MMIO compatibility detection 2021-03-24 17:26:38 +00:00