Received: by 10.223.176.5 with SMTP id f5csp728002wra; Fri, 9 Feb 2018 06:19:01 -0800 (PST) X-Google-Smtp-Source: AH8x224zsxEJMzaoffP/FXV++MRM+5AVEMB5pCDW4JWRiucpeBYaHl2KjU1iYc2wDYVOhvxDydO2 X-Received: by 10.98.224.24 with SMTP id f24mr2979179pfh.157.1518185941474; Fri, 09 Feb 2018 06:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185941; cv=none; d=google.com; s=arc-20160816; b=qUoLQFKMGMxymFJ7YFfJVYETJwUEARI6ox+g1/KHbBWxsNavmCNy3daWe5oJIRjG6Y crR/oUe84wKTua0SOlL3QaRfmumMXDqO4X9lWui4dHeC7h6OFzzfgP1o7Reb2iHot3dA 6b6sL0wlLOv7ztUPK0nz++OCwcUpdihBp7Hj676Jd8ez45mitvmrNKno3zvTu+D5KW0s funV1I6DKJb2rRtX2ZZXMdqP1qfWHVvLSmxxTlwlxJN4cP6RoHoThNi9FCD1Y4DIChcP 8bq+OSkjEzSmxnr8chBdepHRq1WrE/9FhpvyL20j0elPfcB+60pY0FGzDeFOtkrGC1GS xi3w== 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=o2pekvyzS7CfKxZKeONDPqQqPGPVSx0ZWOO8EU2JcjE=; b=fURZg1IzygKB47PwowuCR8VBzamXkYzuo/SgT2i/fr+1Q1f6TG4c1SsQO5b3JdiJXN IdRT6Hc2of433DokusZlRkU0Z3llrQMFE3xyoS54rsTLDCBAgrjSsnRW3CHyBPG6YA1a xMlRnMYC+O+AQQFawzF/O+bLrk2WMHiR9NsOWtHp273U1AP1C0PaWGC7D3pjtIoi1Lc3 YWF1v5Ag3eFD38j/0O0X/RD7H4FCGXeNUtcSVI6q0emghCpp8uA7ZtRIhlWbgNUuHGAI za4nROy1Tm+26aVQ20Ces76akzLMAvVRMV2ZN74bcLKae3oECknvmPmsmcoUi/zdnEDl Px2A== 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 m186si1761210pfm.25.2018.02.09.06.18.47; Fri, 09 Feb 2018 06:19:01 -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 S1752586AbeBIORm (ORCPT + 99 others); Fri, 9 Feb 2018 09:17:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48242 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbeBINkk (ORCPT ); Fri, 9 Feb 2018 08:40:40 -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 D27EF102C; Fri, 9 Feb 2018 13:40:39 +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 03/92] powerpc/64: Convert fast_exception_return to use RFI_TO_USER/KERNEL Date: Fri, 9 Feb 2018 14:38:32 +0100 Message-Id: <20180209133931.435462954@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 a08f828cf47e6c605af21d2cdec68f84e799c318 upstream. Similar to the syscall return path, in fast_exception_return 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 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -859,7 +859,7 @@ BEGIN_FTR_SECTION END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) ACCOUNT_CPU_USER_EXIT(r13, r2, r4) REST_GPR(13, r1) -1: + mtspr SPRN_SRR1,r3 ld r2,_CCR(r1) @@ -872,8 +872,22 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) ld r3,GPR3(r1) ld r4,GPR4(r1) ld r1,GPR1(r1) + RFI_TO_USER + b . /* prevent speculative execution */ - rfid +1: mtspr SPRN_SRR1,r3 + + ld r2,_CCR(r1) + mtcrf 0xFF,r2 + ld r2,_NIP(r1) + mtspr SPRN_SRR0,r2 + + ld r0,GPR0(r1) + ld r2,GPR2(r1) + ld r3,GPR3(r1) + ld r4,GPR4(r1) + ld r1,GPR1(r1) + RFI_TO_KERNEL b . /* prevent speculative execution */ #endif /* CONFIG_PPC_BOOK3E */