Skip to content

Commit 14c7f5b

Browse files
Marc Zyngiergregkh
authored andcommitted
arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls
commit acfb3b8 upstream. 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. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d641053 commit 14c7f5b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/arm64/kvm/handle_exit.c

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

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

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

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

0 commit comments

Comments
 (0)