Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-10 Thread Peter Zijlstra
On Thu, Mar 07, 2019 at 01:18:41PM -0500, Steven Rostedt wrote: > On Thu, 7 Mar 2019 09:45:35 -0800 > Linus Torvalds wrote: > > > On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra wrote: > > > > > > Also; it seems to me that something PT, or maybe even simply: > > > > > > perf -e branches -e

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Steven Rostedt
On Thu, 7 Mar 2019 09:45:35 -0800 Linus Torvalds wrote: > On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra wrote: > > > > Also; it seems to me that something PT, or maybe even simply: > > > > perf -e branches -e branch-misses > > > > would get you similar or sufficient information. > > Yeah,

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Linus Torvalds
On Thu, Mar 7, 2019 at 9:46 AM Josh Poimboeuf wrote: > > Is that possible to do in a C macro? Doesn't seem to work for me... The meat of that macro could easily be done as a helper inline function. But as mentioned, I think a better option would be to remove it entirely, if at all possible.

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Josh Poimboeuf
On Thu, Mar 07, 2019 at 09:29:17AM -0800, h...@zytor.com wrote: > On March 7, 2019 9:18:29 AM PST, Josh Poimboeuf wrote: > >On Thu, Mar 07, 2019 at 09:04:36AM -0800, h...@zytor.com wrote: > >> On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf > >wrote: > >> >On Thu, Mar 07, 2019 at 02:13:12PM

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Josh Poimboeuf
On Thu, Mar 07, 2019 at 06:43:22PM +0100, Peter Zijlstra wrote: > On Thu, Mar 07, 2019 at 10:47:05AM -0600, Josh Poimboeuf wrote: > > > This "fixes" it, and also seems to help -Os make much code: > > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > > index

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Linus Torvalds
On Thu, Mar 7, 2019 at 9:38 AM Peter Zijlstra wrote: > > Also; it seems to me that something PT, or maybe even simply: > > perf -e branches -e branch-misses > > would get you similar or sufficient information. Yeah, I'm not really seeing a lot of upside to PROFILE_ALL_BRANCHES. Particularly

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Peter Zijlstra
On Thu, Mar 07, 2019 at 10:47:05AM -0600, Josh Poimboeuf wrote: > This "fixes" it, and also seems to help -Os make much code: > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > index 445348facea9..8de63db58fdd 100644 > --- a/include/linux/compiler.h > +++

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Peter Zijlstra
On Thu, Mar 07, 2019 at 11:17:09AM -0600, Josh Poimboeuf wrote: > On Thu, Mar 07, 2019 at 09:00:49AM -0800, Linus Torvalds wrote: > > But that macro really is the macro from hell regardless. > > > > Do people really use CONFIG_PROFILE_ALL_BRANCHES? > > IIRC, Steven runs it once a year or so...

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread hpa
On March 7, 2019 9:18:29 AM PST, Josh Poimboeuf wrote: >On Thu, Mar 07, 2019 at 09:04:36AM -0800, h...@zytor.com wrote: >> On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf >wrote: >> >On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote: >> >> On Thu, Mar 07, 2019 at 01:55:26PM +0100,

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Josh Poimboeuf
On Thu, Mar 07, 2019 at 09:04:36AM -0800, h...@zytor.com wrote: > On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf wrote: > >On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote: > >> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote: > >> > On Thu, Mar 07, 2019 at

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Josh Poimboeuf
On Thu, Mar 07, 2019 at 09:00:49AM -0800, Linus Torvalds wrote: > On Thu, Mar 7, 2019 at 8:47 AM Josh Poimboeuf wrote: > > > > This "fixes" it, and also seems to help -Os make much code: > > Yeah, considering that this __trace_if() macro from hell is doing an > 'if()' on the result of that inner

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread hpa
On March 7, 2019 3:45:11 AM PST, Peter Zijlstra wrote: >Teach objtool to validate the UACCESS (SMAP, PAN) rules with are >currently >unenforced and (therefore obviously) violated. > >UACCESS sections should be small; we want to limit the amount of code >that can >touch userspace. Furthermore,

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread hpa
On March 7, 2019 8:47:05 AM PST, Josh Poimboeuf wrote: >On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote: >> On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote: >> > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote: >> >> >> > > 01be 20d3: 31 c0

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Linus Torvalds
On Thu, Mar 7, 2019 at 8:47 AM Josh Poimboeuf wrote: > > This "fixes" it, and also seems to help -Os make much code: Yeah, considering that this __trace_if() macro from hell is doing an 'if()' on the result of that inner thing, it makes sense to *not* use that "looks simpler and shorter" array

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Josh Poimboeuf
On Thu, Mar 07, 2019 at 10:47:05AM -0600, Josh Poimboeuf wrote: > On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote: > > On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote: > > > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote: > > > > > > > > 01be

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Josh Poimboeuf
On Thu, Mar 07, 2019 at 02:13:12PM +0100, Peter Zijlstra wrote: > On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote: > > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote: > > > > > 01be 20d3: 31 c0 xor%eax,%eax > > > 01c0 20d5: 4c 39 eb

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Linus Torvalds
On Thu, Mar 7, 2019 at 4:03 AM Peter Zijlstra wrote: > > Take for instance this one (.config attached); it has both > CONFIG_PROFILE_ALL_BRANCHES=y and CONFIG_TRACE_BRANCH_PROFILING=y > and it compiles: How about just turning off SMAP checking for the really odd cases? At some point it's not

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Peter Zijlstra
On Thu, Mar 07, 2019 at 01:55:26PM +0100, Peter Zijlstra wrote: > On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote: > > 01be 20d3: 31 c0 xor%eax,%eax > > 01c0 20d5: 4c 39 ebcmp%r13,%rbx > > 01c3 20d8: 77 08

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Peter Zijlstra
On Thu, Mar 07, 2019 at 01:03:17PM +0100, Peter Zijlstra wrote: > 01c3 20d8:77 08 ja 20e2 > <__do_sys_waitid+0x1cd> taken: randconfig-build/kernel/exit.o: warning: objtool: __do_sys_waitid()+0x1c3: (branch) > e0f5 alternative("",

Re: [PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Peter Zijlstra
On Thu, Mar 07, 2019 at 12:45:11PM +0100, Peter Zijlstra wrote: > I've only got a few randconfig > failures left (GCC-8) that I'm not quite understanding. Take for instance this one (.config attached); it has both CONFIG_PROFILE_ALL_BRANCHES=y and CONFIG_TRACE_BRANCH_PROFILING=y and it compiles:

[PATCH 00/20] objtool: UACCESS validation v3

2019-03-07 Thread Peter Zijlstra
Teach objtool to validate the UACCESS (SMAP, PAN) rules with are currently unenforced and (therefore obviously) violated. UACCESS sections should be small; we want to limit the amount of code that can touch userspace. Furthermore, UACCESS state isn't scheduled, this means that anything that