From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x2240rvSQlSw/5V7y/GGFjFOZISpousFZvffYiSGANkPqWwo94K6oQj8Au7GnTqyQgYkXzaNu ARC-Seal: i=1; a=rsa-sha256; t=1516610948; cv=none; d=google.com; s=arc-20160816; b=seBmL36X7OfDbGggg4gFBw7eIkvlKsM7B120iiEvCDQ/Wpujqi6oWSHeK8FXjWHCwa xW7Vbm3RTf4VKUS+o2+VxJeQINfJg+Ahx6jyQotPhxeIBdh+qktHt2c0XrD/THfrt1AD NOBA+xjCM/xfZB4yQxmC98tpVqXvhzmLwgZ7kJEKpSIyZgyQOsmXskdqqylfMZyMj8t+ 0R7f0dfuOHNKRGqFHAbY0QEIaZeY9r4amveAvpLSbjtEiO3mgfjot3xlTWCqk80IF0hV 9keU9Qr7b0G9ysOshNMexUSx1yBuIoTziOvZERvPJTqszYaX9UBq41a6cRYK/rbyW1Gx NmWw== 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=piiB6N82i3eiHhV8Z8ZSjegi1fUqGxkCU0oE5/SEKbQ=; b=k5cDirBL5Xe0Pddrzip/pg7eFy2GR/BXYJSEHFHbAnKV66FpHV+HBZlnBbkSd++7EZ BENr2idMJG89oJ15ByAf7q++H3RCo74qb4N/NRb2+wBlTogWS92lo0R49qLErNPMk/4K 42Pf3klyd3zM9BwPzybY84cTE7WRQdnroqdXpIGsPAzTBm99WKLnqiomm12AUgsH2hsM qEjxxcArjwy7464QYjZDbJ3/Cs2iWdOzlTgzijIS3g3vin6c/6oIRSt8bIsJcm6ZJdX+ T2L3mbCltE1mb2Jpa7Meho7c2Z7kcaY1SruD7Ykjxo46VLK9C3yFl/8RiFTkDxQCuD9H qs5g== 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 4.9 39/47] arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls Date: Mon, 22 Jan 2018 09:45:50 +0100 Message-Id: <20180122083928.537571527@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083925.568134913@linuxfoundation.org> References: <20180122083925.568134913@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?1590281427731607418?= X-GMAIL-MSGID: =?utf-8?q?1590281841409758857?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-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 @@ -44,7 +44,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; } @@ -53,7 +53,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; }