Received: by 10.223.176.5 with SMTP id f5csp727161wra; Fri, 9 Feb 2018 06:18:19 -0800 (PST) X-Google-Smtp-Source: AH8x226vdmTEqKjn9ovEZ4QpVSOnUsCElLJYgTbkQvRQMb9dS7OOfvGYMd+GkZzj/yIhfGN2saR3 X-Received: by 10.98.208.3 with SMTP id p3mr3035912pfg.8.1518185899073; Fri, 09 Feb 2018 06:18:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185899; cv=none; d=google.com; s=arc-20160816; b=GVKUo7eWZzSzkPhHh6nkAu/CLGGdnLFv3P58cSqndvpbYVXuNpvEx5HSSz7MnmSuk0 KcZqNCkkFgdGKqIgyoNLiPP1yHA7ukQyz0YY6uOQftm7vWx4Sbvm6GkqTJ1Lo1YFgstP ekumArwYFIuwQ1KBdj7OSpMH4/brdjy6m5UVRZ4jI4jo/BDxswpVxxTgaqpW+cZnOFm3 viba/cWA6ohTRTPljQff1J5pHlEDXFItejF/ALyFGVx1/tEvOjBg7F7jlbmh+Yc2i0Fh HQGluPLJgwuyE01PLG4wTJxucCNmTxpRk0rEFlnIo6Je/CsfyfFmQrOToBCCpHdDamqI YKHg== 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=gB7IYVRxzOJ+sGLaG2xZ6PwKKulDoWq9sr8tFpjIuWo=; b=0hWnNwR5+aU69IHcTF18IdUWyveL2dqyRwb9HDpAh0sHzFOCN9MM1KX8IoAMoG5LNU fdfygb0L+JquYry6szhvCKTJaynBhJuwOB1zygz/yifGx7VnUHjfvgsoYlAgZGWuBMT1 6xo9D2ANcnZWwQfOlQzyImX1VG0qY/5FOZG9VGZGR5+MD3ueqlYFzAwkTBn3mG8/Thip BA0sIQvEOxQqOr/fgKTbChKF8fXnl+ETpYTMa7w2DMIUp/WZ4WQLg26Ldjy6/sZNxDxm 4lkER3hbVS0fY4Rp0XR2SPjgs+CY2V3qw8kQ4dBglDOJjBApXF458t6g1O+pCBJj21VJ gvyA== 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 h6si759604pgp.100.2018.02.09.06.18.04; Fri, 09 Feb 2018 06:18:19 -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 S1752203AbeBINkq (ORCPT + 99 others); Fri, 9 Feb 2018 08:40:46 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48250 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752135AbeBINkn (ORCPT ); Fri, 9 Feb 2018 08:40:43 -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 85E671049; Fri, 9 Feb 2018 13:40:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman Subject: [PATCH 4.9 04/92] powerpc/64: Convert the syscall exit path to use RFI_TO_USER/KERNEL Date: Fri, 9 Feb 2018 14:38:33 +0100 Message-Id: <20180209133931.554992184@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin commit b8e90cb7bc04a509e821e82ab6ed7a8ef11ba333 upstream. In the syscall exit path we may be returning to user or kernel context. We already have a test for that, because we conditionally restore r13. So use that existing test and branch, and bifurcate the return based on that. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/entry_64.S | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -251,13 +251,23 @@ BEGIN_FTR_SECTION END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) ld r13,GPR13(r1) /* only restore r13 if returning to usermode */ + ld r2,GPR2(r1) + ld r1,GPR1(r1) + mtlr r4 + mtcr r5 + mtspr SPRN_SRR0,r7 + mtspr SPRN_SRR1,r8 + RFI_TO_USER + b . /* prevent speculative execution */ + + /* exit to kernel */ 1: ld r2,GPR2(r1) ld r1,GPR1(r1) mtlr r4 mtcr r5 mtspr SPRN_SRR0,r7 mtspr SPRN_SRR1,r8 - RFI + RFI_TO_KERNEL b . /* prevent speculative execution */ syscall_error: