ANDROID: KVM: arm64: Fix MMIO guard unmap

Pierre-Clément reports that the MMIO guard unmap hypercall exposed to
protected guests returns an error upon success. Indeed,
SMCCC_RET_SUCCESS is returned only if __pkvm_remove_ioguard_page()
failed, which doesn't match the expected behaviour.

Fix this by returning SMCCC_RET_INVALID_PARAMETER instead.

Bug: 251426790
Reported-by: Pierre-Clément Tosi <ptosi@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: Id746fa7d5d3a03ee5df6d114a07240822a0be93b
This commit is contained in:
Quentin Perret
2022-10-07 12:27:51 +00:00
committed by Treehugger Robot
parent 809ec777ea
commit 372abe5b53

View File

@@ -1338,6 +1338,8 @@ bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code)
return pkvm_install_ioguard_page(vcpu, exit_code);
case ARM_SMCCC_VENDOR_HYP_KVM_MMIO_GUARD_UNMAP_FUNC_ID:
if (__pkvm_remove_ioguard_page(vcpu, vcpu_get_reg(vcpu, 1)))
val[0] = SMCCC_RET_INVALID_PARAMETER;
else
val[0] = SMCCC_RET_SUCCESS;
break;
case ARM_SMCCC_VENDOR_HYP_KVM_MMIO_GUARD_INFO_FUNC_ID: