summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/hyp/exception.c
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2021-05-06 15:20:12 +0100
committerMarc Zyngier <maz@kernel.org>2021-05-15 10:27:59 +0100
commit26778aaa134a9aefdf5dbaad904054d7be9d656d (patch)
treefc5788ff8c741e307d83e72deffa646cee28797c /arch/arm64/kvm/hyp/exception.c
parentf5e30680616ab09e690b153b7a68ff7dd13e6579 (diff)
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
Diffstat (limited to 'arch/arm64/kvm/hyp/exception.c')
-rw-r--r--arch/arm64/kvm/hyp/exception.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/exception.c b/arch/arm64/kvm/hyp/exception.c
index 0812a496725f..11541b94b328 100644
--- a/arch/arm64/kvm/hyp/exception.c
+++ b/arch/arm64/kvm/hyp/exception.c
@@ -331,8 +331,8 @@ static void kvm_inject_exception(struct kvm_vcpu *vcpu)
}
/*
- * Adjust the guest PC on entry, depending on flags provided by EL1
- * for the purpose of emulation (MMIO, sysreg) or exception injection.
+ * Adjust the guest PC (and potentially exception state) depending on
+ * flags provided by the emulation code.
*/
void __kvm_adjust_pc(struct kvm_vcpu *vcpu)
{