From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 402Yds0xnPzF1N4 for ; Fri, 16 Mar 2018 16:18:40 +1100 (AEDT) Received: by mail-pl0-x243.google.com with SMTP id 61-v6so5294823plf.3 for ; Thu, 15 Mar 2018 22:18:40 -0700 (PDT) Date: Fri, 16 Mar 2018 15:18:23 +1000 From: Nicholas Piggin To: Michal Suchanek Cc: linuxppc-dev@lists.ozlabs.org, Kate Stewart , Madhavan Srinivasan , Paul Mackerras , Michael Neuling , "Bryant G. Ly" , Mahesh Salgaonkar , "Naveen N. Rao" , Daniel Axtens , Al Viro , David Gibson , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Sergey Senozhatsky , =?UTF-8?B?Q8OpZHJpYw==?= Le Goater , Masami Hiramatsu , Andrew Donnellan , Philippe Ombredanne , Joe Perches , Oliver O'Halloran , Andrew Morton , "Tobin C. Harding" Subject: Re: [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry Message-ID: <20180316151823.2f28d5ea@roar.ozlabs.ibm.com> In-Reply-To: References: <20180313200108.GA4082@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, 15 Mar 2018 20:15:52 +0100 Michal Suchanek wrote: > On powerpc syscall entry is done in assembly so patch in an explicit > barrier_nospec. Same comment as Linus for this -- the barriers are before the branch here, so is it possible the branch instruction can be speculative while the index is used to load the syscall table? Thanks, Nick > > Signed-off-by: Michal Suchanek > --- > arch/powerpc/kernel/entry_64.S | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S > index 2cb5109a7ea3..7bfc4cf48af2 100644 > --- a/arch/powerpc/kernel/entry_64.S > +++ b/arch/powerpc/kernel/entry_64.S > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #ifdef CONFIG_PPC_BOOK3S > #include > @@ -159,6 +160,7 @@ system_call: /* label this so stack traces look sane */ > andi. r11,r10,_TIF_SYSCALL_DOTRACE > bne .Lsyscall_dotrace /* does not return */ > cmpldi 0,r0,NR_syscalls > + barrier_nospec > bge- .Lsyscall_enosys > > .Lsyscall: > @@ -319,6 +321,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) > ld r10,TI_FLAGS(r10) > > cmpldi r0,NR_syscalls > + barrier_nospec > blt+ .Lsyscall > > /* Return code is already in r3 thanks to do_syscall_trace_enter() */