From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls
Date: Tue, 16 Jan 2018 11:42:49 +0100 [thread overview]
Message-ID: <20180116104249.GO21403@cbox> (raw)
In-Reply-To: <20180116102347.20892-1-marc.zyngier@arm.com>
On Tue, Jan 16, 2018 at 10:23:47AM +0000, Marc Zyngier wrote:
> 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: stable@vger.kernel.org
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
And applied to kvmarm/master. I'll attempt to herd this upstream asap.
-Christoffer
> ---
> This has been identified as an issue when working on the Spectre issues,
> as guest have to perform HVC/SMC calls to invalidate their branch predictors,
> and need to perform some form of discovery. 32bit is affected too, but the
> mitigation doesn't involve firmware, so we can fix it separately.
>
> arch/arm64/kvm/handle_exit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> index 304203fa9e33..e60494f1eef9 100644
> --- a/arch/arm64/kvm/handle_exit.c
> +++ b/arch/arm64/kvm/handle_exit.c
> @@ -45,7 +45,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
>
> ret = kvm_psci_call(vcpu);
> if (ret < 0) {
> - kvm_inject_undefined(vcpu);
> + vcpu_set_reg(vcpu, 0, ~0UL);
> return 1;
> }
>
> @@ -54,7 +54,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
>
> static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
> {
> - kvm_inject_undefined(vcpu);
> + vcpu_set_reg(vcpu, 0, ~0UL);
> return 1;
> }
>
> --
> 2.14.2
>
prev parent reply other threads:[~2018-01-16 10:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-16 10:23 [PATCH] arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls Marc Zyngier
2018-01-16 10:42 ` Christoffer Dall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180116104249.GO21403@cbox \
--to=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.