[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFw8LJ7T_4jTe4q5q0d2JuP0iBWdwcTXZULKe-c4w7QrPA@mail.gmail.com>
Date: Thu, 15 Mar 2018 14:37:25 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Michal Suchanek <msuchanek@...e.de>
Cc: ppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
Paul Mackerras <paulus@...ba.org>,
Michael Neuling <mikey@...ling.org>,
"Bryant G. Ly" <bryantly@...ux.vnet.ibm.com>,
Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Daniel Axtens <dja@...ens.net>,
Nicholas Piggin <npiggin@...il.com>,
Al Viro <viro@...iv.linux.org.uk>,
David Gibson <david@...son.dropbear.id.au>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Cédric Le Goater <clg@...d.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
Philippe Ombredanne <pombredanne@...b.com>,
Joe Perches <joe@...ches.com>,
"Oliver O'Halloran" <oohall@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Tobin C. Harding" <me@...in.cc>
Subject: Re: [PATCH RFC rebase 2/9] powerpc: Use barrier_nospec in copy_from_user
On Thu, Mar 15, 2018 at 12:15 PM, Michal Suchanek <msuchanek@...e.de> wrote:
> This is based on x86 patch doing the same.
>
> Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> ---
> --- a/arch/powerpc/include/asm/uaccess.h
> +++ b/arch/powerpc/include/asm/uaccess.h
> @@ -258,8 +259,10 @@ do { \
> long __gu_err = -EFAULT; \
> unsigned long __gu_val = 0; \
> const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
> + int can_access = access_ok(VERIFY_READ, __gu_addr, (size)); \
> might_fault(); \
> - if (access_ok(VERIFY_READ, __gu_addr, (size))) \
> + barrier_nospec(); \
> + if (can_access) \
> __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
> (x) = (__force __typeof__(*(ptr)))__gu_val; \
> __gu_err; \
Is the above really correct? The barrier is *before* the conditional
branch that might be mis-predicted.
I don't know how the ppc barrier works, but that sounds completely bogus.
Linus
Powered by blists - more mailing lists