Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-06 Thread Mark Rutland
On Fri, Jan 05, 2018 at 09:23:06PM -0800, Dan Williams wrote: > On Fri, Jan 5, 2018 at 6:55 PM, Linus Torvalds > wrote: > > On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams > > wrote: > >> +#ifndef nospec_ptr > >> +#define nospec_ptr(ptr, lo,

Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-06 Thread Mark Rutland
On Fri, Jan 05, 2018 at 09:23:06PM -0800, Dan Williams wrote: > On Fri, Jan 5, 2018 at 6:55 PM, Linus Torvalds > wrote: > > On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams > > wrote: > >> +#ifndef nospec_ptr > >> +#define nospec_ptr(ptr, lo, hi) > >>

Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-05 Thread Dan Williams
On Fri, Jan 5, 2018 at 6:55 PM, Linus Torvalds wrote: > On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams wrote: >> +#ifndef nospec_ptr >> +#define nospec_ptr(ptr, lo, hi) >>\ > > Do we actually

Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-05 Thread Dan Williams
On Fri, Jan 5, 2018 at 6:55 PM, Linus Torvalds wrote: > On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams wrote: >> +#ifndef nospec_ptr >> +#define nospec_ptr(ptr, lo, hi) >>\ > > Do we actually want this horrible interface? > > It just causes the

Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-05 Thread Linus Torvalds
On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams wrote: > +#ifndef nospec_ptr > +#define nospec_ptr(ptr, lo, hi) > \ Do we actually want this horrible interface? It just causes the compiler - or inline asm - to generate worse

Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-05 Thread Linus Torvalds
On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams wrote: > +#ifndef nospec_ptr > +#define nospec_ptr(ptr, lo, hi) > \ Do we actually want this horrible interface? It just causes the compiler - or inline asm - to generate worse code, because it needs to

[PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-05 Thread Dan Williams
From: Mark Rutland Under speculation, CPUs may mis-predict branches in bounds checks. Thus, memory accesses under a bounds check may be speculated even if the bounds check fails, providing a primitive for building a side channel. This patch adds helpers which can be used

[PATCH 01/18] asm-generic/barrier: add generic nospec helpers

2018-01-05 Thread Dan Williams
From: Mark Rutland Under speculation, CPUs may mis-predict branches in bounds checks. Thus, memory accesses under a bounds check may be speculated even if the bounds check fails, providing a primitive for building a side channel. This patch adds helpers which can be used to inhibit the use of