Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-30 Thread Dave Hansen
On 04/30/2018 12:51 AM, Ram Pai wrote: > /* >* Look for a protection-key-drive execute-only mapping >* which is now being given permissions that are not >* execute-only. Move it back to the default pkey. >*/ > if (vma_is_pkey_exec_only(vma) && (prot != P

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-30 Thread Ram Pai
On Thu, Apr 26, 2018 at 10:57:31AM -0700, Dave Hansen wrote: > On 04/06/2018 06:09 PM, Ram Pai wrote: > > Well :). my point is add this code and delete the other > > code that you add later in that function. > > I don't think I'm understanding what your suggestion was. I looked at > the code and

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-26 Thread Dave Hansen
On 04/26/2018 01:55 AM, Thomas Gleixner wrote: >> Hi Dave, are you planning to send the next version of this patch or >> going with this one? > Right, some enlightment would be appreciated. I'm lost in the dozen > different threads discussing this back and forth. Shakeel, thanks for the reminder!

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-26 Thread Dave Hansen
On 04/06/2018 06:09 PM, Ram Pai wrote: > Well :). my point is add this code and delete the other > code that you add later in that function. I don't think I'm understanding what your suggestion was. I looked at the code and I honestly do not think I can remove any of it. For the plain (non-expli

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-26 Thread Thomas Gleixner
On Wed, 25 Apr 2018, Shakeel Butt wrote: > On Mon, Mar 26, 2018 at 5:27 PM, Dave Hansen > wrote: > > > > From: Dave Hansen > > > > I got a bug report that the following code (roughly) was > > causing a SIGSEGV: > > > > mprotect(ptr, size, PROT_EXEC); > > mprotect(ptr, size, PROT_N

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-25 Thread Shakeel Butt
On Mon, Mar 26, 2018 at 5:27 PM, Dave Hansen wrote: > > From: Dave Hansen > > I got a bug report that the following code (roughly) was > causing a SIGSEGV: > > mprotect(ptr, size, PROT_EXEC); > mprotect(ptr, size, PROT_NONE); > mprotect(ptr, size, PROT_READ); > *pt

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-06 Thread Ram Pai
On Fri, Apr 06, 2018 at 05:47:29PM -0700, Dave Hansen wrote: > On 04/06/2018 05:09 PM, Ram Pai wrote: > >> - /* > >> - * Look for a protection-key-drive execute-only mapping > >> - * which is now being given permissions that are not > >> - * execute-only. Move it back to the default pkey. >

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-06 Thread Dave Hansen
On 04/06/2018 05:09 PM, Ram Pai wrote: >> -/* >> - * Look for a protection-key-drive execute-only mapping >> - * which is now being given permissions that are not >> - * execute-only. Move it back to the default pkey. >> - */ >> -if (vma_is_pkey_exec_only(vma) && >> -

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-04-06 Thread Ram Pai
On Mon, Mar 26, 2018 at 10:27:27AM -0700, Dave Hansen wrote: > > From: Dave Hansen > > I got a bug report that the following code (roughly) was > causing a SIGSEGV: > > mprotect(ptr, size, PROT_EXEC); > mprotect(ptr, size, PROT_NONE); > mprotect(ptr, size, PROT_READ); >

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Dave Hansen
On 03/23/2018 12:45 PM, Thomas Gleixner wrote: >> The fixes tag makes sense in general even if the patch is not tagged for >> stable. It gives you immediate context and I use it a lot to look why this >> went unnoticed or what the context of that change was. > That said, I'm even lazier than you an

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Thomas Gleixner
On Fri, 23 Mar 2018, Thomas Gleixner wrote: > On Fri, 23 Mar 2018, Dave Hansen wrote: > > > On 03/23/2018 12:15 PM, Shakeel Butt wrote: > > >> We had a check for PROT_READ/WRITE, but it did not work > > >> for PROT_NONE. This entirely removes the PROT_* checks, > > >> which ensures that PROT_NON

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Thomas Gleixner
On Fri, 23 Mar 2018, Dave Hansen wrote: > On 03/23/2018 12:15 PM, Shakeel Butt wrote: > >> We had a check for PROT_READ/WRITE, but it did not work > >> for PROT_NONE. This entirely removes the PROT_* checks, > >> which ensures that PROT_NONE now works. > >> > >> Reported-by: Shakeel Butt > >> Si

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Dave Hansen
On 03/23/2018 12:27 PM, Shakeel Butt wrote: > On Fri, Mar 23, 2018 at 12:23 PM, Dave Hansen wrote: >> On 03/23/2018 12:15 PM, Shakeel Butt wrote: We had a check for PROT_READ/WRITE, but it did not work for PROT_NONE. This entirely removes the PROT_* checks, which ensures that PROT_

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Shakeel Butt
On Fri, Mar 23, 2018 at 12:23 PM, Dave Hansen wrote: > On 03/23/2018 12:15 PM, Shakeel Butt wrote: >>> We had a check for PROT_READ/WRITE, but it did not work >>> for PROT_NONE. This entirely removes the PROT_* checks, >>> which ensures that PROT_NONE now works. >>> >>> Reported-by: Shakeel Butt

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Dave Hansen
On 03/23/2018 12:15 PM, Shakeel Butt wrote: >> We had a check for PROT_READ/WRITE, but it did not work >> for PROT_NONE. This entirely removes the PROT_* checks, >> which ensures that PROT_NONE now works. >> >> Reported-by: Shakeel Butt >> Signed-off-by: Dave Hansen > Should there be a 'Fixes' t

Re: [PATCH 4/9] x86, pkeys: override pkey when moving away from PROT_EXEC

2018-03-23 Thread Shakeel Butt
On Fri, Mar 23, 2018 at 11:09 AM, Dave Hansen wrote: > > From: Dave Hansen > > I got a bug report that the following code (roughly) was > causing a SIGSEGV: > > mprotect(ptr, size, PROT_EXEC); > mprotect(ptr, size, PROT_NONE); > mprotect(ptr, size, PROT_READ); > *p