diff options
author | Christoffer Dall <christoffer.dall@arm.com> | 2018-10-17 20:21:16 +0200 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-10-19 11:13:03 +0100 |
commit | e4e11cc0f81ee7be17d6f6fb96128a6d51c0e838 (patch) | |
tree | 16a1070795b753152fff3b97c20f7bdc18123a0c /arch/arm64/kvm/handle_exit.c | |
parent | 58bf437ff64eac8aca606e42d7e4623e40b61fa1 (diff) | |
download | lwn-e4e11cc0f81ee7be17d6f6fb96128a6d51c0e838.tar.gz lwn-e4e11cc0f81ee7be17d6f6fb96128a6d51c0e838.zip |
KVM: arm64: Safety check PSTATE when entering guest and handle IL
This commit adds a paranoid check when entering the guest to make sure
we don't attempt running guest code in an equally or more privilged mode
than the hypervisor. We also catch other accidental programming of the
SPSR_EL2 which results in an illegal exception return and report this
safely back to the user.
Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64/kvm/handle_exit.c')
-rw-r--r-- | arch/arm64/kvm/handle_exit.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index e5e741bfffe1..35a81bebd02b 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -284,6 +284,13 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, */ run->exit_reason = KVM_EXIT_FAIL_ENTRY; return 0; + case ARM_EXCEPTION_IL: + /* + * We attempted an illegal exception return. Guest state must + * have been corrupted somehow. Give up. + */ + run->exit_reason = KVM_EXIT_FAIL_ENTRY; + return -EINVAL; default: kvm_pr_unimpl("Unsupported exception type: %d", exception_index); |