From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224P0U9GMu9YfKRJUPsKABaQW8KQGAYy+nGREwVaP2pvv81LfXzLLkRzpU7hvs5QDd0gG/by ARC-Seal: i=1; a=rsa-sha256; t=1517256657; cv=none; d=google.com; s=arc-20160816; b=VJC9qHQHqNTiUUeg0a43b+nSZVm8WvYnOCSy/sbUzj1UYFdxWiwzeEIzR75zt8n0RI SyejfSNKs7BWmhJmUQ20rgJ8l4r58caffbwjZvQ/+oAjUKWmlHiO5gBWbK2dRilETfRN bMqW/4zk1oyOkdnUmUdontG23lO5OooliVY9/m1MH33RYRyC7twbSn0XLrBdxqhH8i40 P/ir/O0qrxICK6KZ73JyaoilDUiGIjckqJO+yJqxQ4CLFyh+NKZspDmYNA7wqFz6L+PK Q56wY3xzhXFj+ZGS6pvWHc1GelTu8xRrt1lCUEib843yzIEne3QcOfTpSHyPFVyFhwdY niCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3dEMW5nGus8gOKNlX3KkU51BWsv/UaQrbcliKKDp5Qg=; b=g9FXAnE+QBL2qFnZppFnwbFzUrg5Uj9tlZJJoLrw2RVKCJmW2auFHcywqem+h2P1i1 /+QDlbptaUYjYbpfupl7Tb3XivlAyWtSZhgvnKvVuGWnocrK4FbS9SqxPl3UYq4zVFtO qFuBkZJwKVdGg69hqC9x5i/GliHUFzjtK+uazT7vGJaOo5uLQUNeRXQCtPHZsyfHvqyD I6zw23bPg1LCTYQoKrHp8HYHOfRYE6RehY/F8hOQUaQi5OKrNG02d+mG2b7o3KpMM4rN aQLlkKyGaWpO6ieSfBdMDoXwDcTnwmWfreOhwCiT4Ls8jf5ygfYDvIWi6p2/04bRsyAl jkHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PATCH 3.18 18/52] arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls Date: Mon, 29 Jan 2018 13:56:36 +0100 Message-Id: <20180129123628.992889863@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123628.168904217@linuxfoundation.org> References: <20180129123628.168904217@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958916597251315?= X-GMAIL-MSGID: =?utf-8?q?1590958916597251315?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier commit acfb3b883f6d6a4b5d27ad7fdded11f6a09ae6dd 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 Signed-off-by: Christoffer Dall Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kvm/handle_exit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -34,7 +34,7 @@ static int handle_hvc(struct kvm_vcpu *v ret = kvm_psci_call(vcpu); if (ret < 0) { - kvm_inject_undefined(vcpu); + *vcpu_reg(vcpu, 0) = ~0UL; return 1; } @@ -43,7 +43,7 @@ static int handle_hvc(struct kvm_vcpu *v static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run) { - kvm_inject_undefined(vcpu); + *vcpu_reg(vcpu, 0) = ~0UL; return 1; }