mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
BACKPORT: KVM: arm64: Actually prevent SMC64 SYSTEM_RESET2 from AArch32
The SMCCC does not allow the SMC64 calling convention to be used from AArch32. While KVM checks to see if the calling convention is allowed in PSCI_1_0_FN_PSCI_FEATURES, it does not actually prevent calls to unadvertised PSCI v1.0+ functions. Hoist the check to see if the requested function is allowed into kvm_psci_call(), thereby preventing SMC64 calls from AArch32 for all PSCI versions. Bug: 254441685 Fixes:d43583b890("KVM: arm64: Expose PSCI SYSTEM_RESET2 call to the guest") Acked-by: Will Deacon <will@kernel.org> Reviewed-by: Reiji Watanabe <reijiw@google.com> Signed-off-by: Oliver Upton <oupton@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220322183538.2757758-3-oupton@google.com (cherry picked from commit827c2ab331) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: I0f2909827c481850014d6bdab321ff107d59196d
This commit is contained in:
committed by
Treehugger Robot
parent
c6408580e1
commit
9e059fe061
@@ -204,10 +204,6 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
|
|||||||
unsigned long val;
|
unsigned long val;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
val = kvm_psci_check_allowed_function(vcpu, psci_fn);
|
|
||||||
if (val)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
switch (psci_fn) {
|
switch (psci_fn) {
|
||||||
case PSCI_0_2_FN_PSCI_VERSION:
|
case PSCI_0_2_FN_PSCI_VERSION:
|
||||||
/*
|
/*
|
||||||
@@ -275,7 +271,6 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
smccc_set_retval(vcpu, val, 0, 0, 0);
|
smccc_set_retval(vcpu, val, 0, 0, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -395,6 +390,15 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)
|
|||||||
*/
|
*/
|
||||||
int kvm_psci_call(struct kvm_vcpu *vcpu)
|
int kvm_psci_call(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
|
u32 psci_fn = smccc_get_function(vcpu);
|
||||||
|
unsigned long val;
|
||||||
|
|
||||||
|
val = kvm_psci_check_allowed_function(vcpu, psci_fn);
|
||||||
|
if (val) {
|
||||||
|
smccc_set_retval(vcpu, val, 0, 0, 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
switch (kvm_psci_version(vcpu, vcpu->kvm)) {
|
switch (kvm_psci_version(vcpu, vcpu->kvm)) {
|
||||||
case KVM_ARM_PSCI_1_1:
|
case KVM_ARM_PSCI_1_1:
|
||||||
return kvm_psci_1_x_call(vcpu, 1);
|
return kvm_psci_1_x_call(vcpu, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user