linux/arch/arm64/kvm/hyp
Marc Zyngier 26778aaa13 KVM: arm64: Commit pending PC adjustemnts before returning to userspace
KVM currently updates PC (and the corresponding exception state)
using a two phase approach: first by setting a set of flags,
then by converting these flags into a state update when the vcpu
is about to enter the guest.

However, this creates a disconnect with userspace if the vcpu thread
returns there with any exception/PC flag set. In this case, the exposed
context is wrong, as userspace doesn't have access to these flags
(they aren't architectural). It also means that these flags are
preserved across a reset, which isn't expected.

To solve this problem, force an explicit synchronisation of the
exception state on vcpu exit to userspace. As an optimisation
for nVHE systems, only perform this when there is something pending.

Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Tested-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org # 5.11
2021-05-15 10:27:59 +01:00
..
include KVM: arm64: Move __adjust_pc out of line 2021-05-15 10:27:59 +01:00
nvhe KVM: arm64: Commit pending PC adjustemnts before returning to userspace 2021-05-15 10:27:59 +01:00
vhe KVM: arm64: Move __adjust_pc out of line 2021-05-15 10:27:59 +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: Don't use cbz/adr with external symbols 2021-03-09 08:48:24 +00:00
exception.c KVM: arm64: Commit pending PC adjustemnts before returning to userspace 2021-05-15 10:27: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: make the hyp vector table entries local 2021-02-24 11:20:43 +00:00
Makefile KVM: arm64: Prepare the creation of s1 mappings at EL2 2021-03-19 12:01:21 +00:00
pgtable.c KVM: arm64: Introduce KVM_PGTABLE_S2_IDMAP stage 2 flag 2021-03-19 12:01:22 +00:00
reserved_mem.c KVM: arm64: Sort the hypervisor memblocks 2021-03-19 12:01:22 +00: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