Received: by 10.223.176.46 with SMTP id f43csp2646424wra; Mon, 22 Jan 2018 00:48:46 -0800 (PST) X-Google-Smtp-Source: AH8x2255XV0WQj6yxjdoatZX5S6yMfZCP3+aWXAsu0t25Jr8tRydWWfWLGG5c6pRKs7M5ggRveQ2 X-Received: by 2002:a17:902:380c:: with SMTP id l12-v6mr2699035plc.8.1516610926480; Mon, 22 Jan 2018 00:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516610926; cv=none; d=google.com; s=arc-20160816; b=iAEARwLyawjj4Vct5dL8HvKLRHLCJEmy0Fm/nfoIS5Yst8NdIFVU0I9MKGxxeH2OKM wTmYF4IErwXbKaqK8y7z8PQC72R70zH6Fww1E6/w2bJqj1T5vVPn17js+Sht0UN2T3cU rtwkBDAOlgtrk8gldcuXC/u47kKnE0qigfpqIqSMajm0kj0SQNysBIvorWnl0zRlGhk4 834AIcmo4duGD0syhWytUr0PdljKp0isyWrBQjm6yM07cYZpUanlVp/p3Evbe1F8Kf0R x2m1vA71p0RNPd6S8JVQzUc7aqKyYJSaNNv8PhUfCZCriQjF48UF2+hTuhiHuv7d0qgF WPrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4fYwEXgFq2ho/j89JNGfZGnlJbdeaPdl+1NdgvyfOJA=; b=hbwiQGHuaE0f3aBsrLw0xH+YnxVmGJ6haOlreFIzGRLxZj/JWU+XvLNd0rABd2Tn0b mSYBkZaw5leSkCp1toWUu0dDjjY6Vz/mSbaxAqr5uzQou0nGTPLxlL4gMfK4EWE75Z7Y 0E9cQsOA/jgNLv1p8iA5Uw4QpiYhrNhzTywXfmYJa6uqtXG2LleBtPFS38dMDmFNPk55 0I9kwya5cdQckfnTj4eFK9G1pSB0aNAD3omiNvS4jI3havVlsb1L8fUrSXbeu0UoiO1g Re4771ix5byjqt2tFqLPt7RcfdmQx2pvvMfj2mgy1OoA2EsePmKzAoofGPA4ciOXa70n nYzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b130si13756278pga.61.2018.01.22.00.48.32; Mon, 22 Jan 2018 00:48:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbeAVImf (ORCPT + 99 others); Mon, 22 Jan 2018 03:42:35 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:58960 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057AbeAVImc (ORCPT ); Mon, 22 Jan 2018 03:42:32 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9AAEAF33; Mon, 22 Jan 2018 08:42:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PATCH 4.4 45/53] arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls Date: Mon, 22 Jan 2018 09:40:37 +0100 Message-Id: <20180122083912.531569230@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083910.299610926@linuxfoundation.org> References: <20180122083910.299610926@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-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 @@ -42,7 +42,7 @@ static int handle_hvc(struct kvm_vcpu *v ret = kvm_psci_call(vcpu); if (ret < 0) { - kvm_inject_undefined(vcpu); + vcpu_set_reg(vcpu, 0, ~0UL); return 1; } @@ -51,7 +51,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_set_reg(vcpu, 0, ~0UL); return 1; }