From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224vGqUKENyh578RwmC0uYdu2dOJ6arqkaIMQBM6EdQWy4+K7qj91GGuzn4xdY9mOBcTrNa0 ARC-Seal: i=1; a=rsa-sha256; t=1516610553; cv=none; d=google.com; s=arc-20160816; b=OKq7SrIDzgKijDyRL1oVlGPab/nk/knior8hHUdlooRwKTAVhb3i901uvwreAbfQpf +E9ShBJb7/u0RbY5zKP/ExbWSVGPT6Zigljtx3QDusJXH37JjUqP4paQzXMKvYv1XP5U gGG394PJLn4M3uHoK3IjE/LBDQn+o//xk3ussHVMsLEFf4zmCdrRDfJ4Ct4raU8/UvVI SI/MWADYHy7pQTabBPdkxjzk1HDftgzbhHFBWqp0COSz1r45xB7Ou9uFd6v2DPCmvFUv hhV4aKhBvEKMtkk1cpa+V2kOvjW8h96Wfi9wiAf3MxzTcb/pRTkiCwZYRmFucfz4oW2R 0K7g== 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=4fYwEXgFq2ho/j89JNGfZGnlJbdeaPdl+1NdgvyfOJA=; b=F3ajyJ1ggUqRSmkXyeuKg5jUev5O39wJWVpOmGhcfp2FOT5iThUb52u7Pz39W0rq/f 1dyMjx2KIqvdo3yvknCVJifOOSdc3wNbfqXLi0Rnjcb3bGt7l8OGvoppjtrdaXVxX0fj hgXoMWIiyrQLLdjcZahUTwklmXr7dKsHHIShip47Y9Y7I7qbEP/1k8++l545/TOYAb8p SOUAl2pu961L7zQb4mxOme8fnqbClnKh5CuXSYAuaxGp06P1z6nuN79jdqFReRuqCat4 eMq7zcRi3kAkpNZ/tcuEg1Q02QtawcnppPI+B5jOvonIJCnCNE9Pkkubo/raATgfwkJm ZaNA== 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.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 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?1590281427731607418?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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; }