Commit 2da0aebc authored by Oliver Upton's avatar Oliver Upton Committed by Marc Zyngier

KVM: arm64: Generally disallow SMC64 for AArch32 guests

The only valid calling SMC calling convention from an AArch32 state is
SMC32. Disallow any PSCI function that sets the SMC64 function ID bit
when called from AArch32 rather than comparing against known SMC64 PSCI
functions.

Note that without this change KVM advertises the SMC64 flavor of
SYSTEM_RESET2 to AArch32 guests.

Fixes: d43583b8 ("KVM: arm64: Expose PSCI SYSTEM_RESET2 call to the guest")
Acked-by: default avatarWill Deacon <will@kernel.org>
Reviewed-by: default avatarReiji Watanabe <reijiw@google.com>
Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
Signed-off-by: default avatarOliver Upton <oupton@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220322183538.2757758-2-oupton@google.com
parent 31231092
...@@ -215,15 +215,11 @@ static void kvm_psci_narrow_to_32bit(struct kvm_vcpu *vcpu) ...@@ -215,15 +215,11 @@ static void kvm_psci_narrow_to_32bit(struct kvm_vcpu *vcpu)
static unsigned long kvm_psci_check_allowed_function(struct kvm_vcpu *vcpu, u32 fn) static unsigned long kvm_psci_check_allowed_function(struct kvm_vcpu *vcpu, u32 fn)
{ {
switch(fn) { /*
case PSCI_0_2_FN64_CPU_SUSPEND: * Prevent 32 bit guests from calling 64 bit PSCI functions.
case PSCI_0_2_FN64_CPU_ON: */
case PSCI_0_2_FN64_AFFINITY_INFO: if ((fn & PSCI_0_2_64BIT) && vcpu_mode_is_32bit(vcpu))
/* Disallow these functions for 32bit guests */ return PSCI_RET_NOT_SUPPORTED;
if (vcpu_mode_is_32bit(vcpu))
return PSCI_RET_NOT_SUPPORTED;
break;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment