Skip to content

Commit acfb3b8

Browse files
Marc Zyngierchazy
authored andcommitted
arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls
KVM doesn't follow the SMCCC when it comes to unimplemented calls, and inject an UNDEF instead of returning an error. Since firmware calls are now used for security mitigation, they are becoming more common, and the undef is counter productive. Instead, let's follow the SMCCC which states that -1 must be returned to the caller when getting an unknown function number. Cc: <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
1 parent f8f85dc commit acfb3b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/kvm/handle_exit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
4545

4646
ret = kvm_psci_call(vcpu);
4747
if (ret < 0) {
48-
kvm_inject_undefined(vcpu);
48+
vcpu_set_reg(vcpu, 0, ~0UL);
4949
return 1;
5050
}
5151

@@ -54,7 +54,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
5454

5555
static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
5656
{
57-
kvm_inject_undefined(vcpu);
57+
vcpu_set_reg(vcpu, 0, ~0UL);
5858
return 1;
5959
}
6060

0 commit comments

Comments
 (0)