From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224rPduxxCMU1HC/ZWHixSEwqLqvicedGqReA2EUCpB/rDwvQYPzTdPpxzOwD2qQcYQozgpC ARC-Seal: i=1; a=rsa-sha256; t=1516611072; cv=none; d=google.com; s=arc-20160816; b=lPLA55egf10lNbf4IemTIM4OI5cHLwUHnU0R+prDliygDC/aDSu1iTP/DbRcYmYpO7 kkueZUjXaI5f0qX+omDJLIDXyPqmOUziKhxD4eBEg91EHF4aibFDjL1g7S1nJhiDS8zS ZA1AYQwBPr2JgyWUujM/p1baqlaAgvQ2nWOfZE4juY8gCFK9LycEkVUXTpSV+sCyYz5R bDLIYm7WEPCndzbt5IPh++tjkIoMv/uklZb/ecR4kMFl0AgpK1HIee5/GOe3NszMjqT9 5HAH7sfsmilYOutYQ3q0FlzeZl2V8UhI0oCQDij7aZq/ojESKaW7WRDVi9RBFprlqO9/ ++YA== 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=UW/dXZ5y2lffLe1iT4t3Y6M2h8gxOC0qxlCxFWelna4=; b=bZk/frkZf+nRzg++ztkyQTPaOLoHcvHqrZ5rTlFuY6sd6WQvvU1XNEugqBtlmJximJ q+djVOrwK8/dinfEgmczDFoOYROBxo9wQQS2bH62fA9bafJm97SgFTg/Nc0Iumj4vKbF BUhcyD3eG6VqnWjRdUSvOPquZIT2MR/bF293nQTQEns6b6YF9MXsyrNyuZhSenOjLwzH Gj2xTQSI1BlGAe7T3YHh+7kRc247Tcoy4Excw9PTX5734gCagQifV1HFOQuhPfp99MuE DJKOSehx9xDV7LkWfvSTUooscsb269pvSMk2JshkJKMcpvcpSGzY8LyVry/mEuO2gt7A eNMg== 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, Nicholas Piggin , Michael Ellerman Subject: [PATCH 4.14 09/89] powerpc/64: Convert the syscall exit path to use RFI_TO_USER/KERNEL Date: Mon, 22 Jan 2018 09:44:49 +0100 Message-Id: <20180122083955.619260564@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083954.683903493@linuxfoundation.org> References: <20180122083954.683903493@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?1590281972105842033?= X-GMAIL-MSGID: =?utf-8?q?1590281972105842033?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-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 @@ -267,13 +267,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 */ .Lsyscall_error: