Re: pkeys on POWER: Access rights not reset on execve

2018-06-12 Thread Florian Weimer
On 06/11/2018 10:08 PM, Ram Pai wrote: Ok. try this patch. This patch is on top of the 5 patches that I had sent last week i.e "[PATCH 0/5] powerpc/pkeys: fixes to pkeys" The following is a draft patch though to check if it meets your expectations. commit

Re: pkeys on POWER: Access rights not reset on execve

2018-06-11 Thread Ram Pai
On Mon, Jun 11, 2018 at 07:29:33PM +0200, Florian Weimer wrote: > On 06/11/2018 07:23 PM, Ram Pai wrote: > >On Fri, Jun 08, 2018 at 07:53:51AM +0200, Florian Weimer wrote: > >>On 06/08/2018 04:34 AM, Ram Pai wrote: > > So the remaining question at this point is whether the Intel >

Re: pkeys on POWER: Access rights not reset on execve

2018-06-11 Thread Florian Weimer
On 06/11/2018 07:23 PM, Ram Pai wrote: On Fri, Jun 08, 2018 at 07:53:51AM +0200, Florian Weimer wrote: On 06/08/2018 04:34 AM, Ram Pai wrote: So the remaining question at this point is whether the Intel behavior (default-deny instead of default-allow) is preferable. Florian, remind me what

Re: pkeys on POWER: Access rights not reset on execve

2018-06-11 Thread Ram Pai
On Fri, Jun 08, 2018 at 07:53:51AM +0200, Florian Weimer wrote: > On 06/08/2018 04:34 AM, Ram Pai wrote: > >> > >>So the remaining question at this point is whether the Intel > >>behavior (default-deny instead of default-allow) is preferable. > > > >Florian, remind me what behavior needs to fixed?

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Michal Suchánek
On Fri, 8 Jun 2018 15:51:03 +0200 Florian Weimer wrote: > On 06/08/2018 03:49 PM, Michal Suchánek wrote: > > On Fri, 8 Jun 2018 14:57:06 +0200 > > Florian Weimer wrote: > > > >> On 06/08/2018 02:54 PM, Michal Suchánek wrote: > >>> On Fri, 8 Jun 2018 12:44:53 +0200 > >>> Florian Weimer

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Florian Weimer
On 06/08/2018 03:49 PM, Michal Suchánek wrote: On Fri, 8 Jun 2018 14:57:06 +0200 Florian Weimer wrote: On 06/08/2018 02:54 PM, Michal Suchánek wrote: On Fri, 8 Jun 2018 12:44:53 +0200 Florian Weimer wrote: On 06/08/2018 12:15 PM, Michal Suchánek wrote: On Fri, 8 Jun 2018 07:53:51

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Michal Suchánek
On Fri, 8 Jun 2018 14:57:06 +0200 Florian Weimer wrote: > On 06/08/2018 02:54 PM, Michal Suchánek wrote: > > On Fri, 8 Jun 2018 12:44:53 +0200 > > Florian Weimer wrote: > > > >> On 06/08/2018 12:15 PM, Michal Suchánek wrote: > >>> On Fri, 8 Jun 2018 07:53:51 +0200 > >>> Florian Weimer

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Florian Weimer
On 06/08/2018 02:54 PM, Michal Suchánek wrote: On Fri, 8 Jun 2018 12:44:53 +0200 Florian Weimer wrote: On 06/08/2018 12:15 PM, Michal Suchánek wrote: On Fri, 8 Jun 2018 07:53:51 +0200 Florian Weimer wrote: On 06/08/2018 04:34 AM, Ram Pai wrote: So the remaining question at this point

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Michal Suchánek
On Fri, 8 Jun 2018 12:44:53 +0200 Florian Weimer wrote: > On 06/08/2018 12:15 PM, Michal Suchánek wrote: > > On Fri, 8 Jun 2018 07:53:51 +0200 > > Florian Weimer wrote: > > > >> On 06/08/2018 04:34 AM, Ram Pai wrote: > > So the remaining question at this point is whether the

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Florian Weimer
On 06/08/2018 12:15 PM, Michal Suchánek wrote: On Fri, 8 Jun 2018 07:53:51 +0200 Florian Weimer wrote: On 06/08/2018 04:34 AM, Ram Pai wrote: So the remaining question at this point is whether the Intel behavior (default-deny instead of default-allow) is preferable. Florian, remind me

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Michal Suchánek
On Fri, 8 Jun 2018 07:53:51 +0200 Florian Weimer wrote: > On 06/08/2018 04:34 AM, Ram Pai wrote: > >> > >> So the remaining question at this point is whether the Intel > >> behavior (default-deny instead of default-allow) is preferable. > > > > Florian, remind me what behavior needs to fixed?

Re: pkeys on POWER: Access rights not reset on execve

2018-06-08 Thread Florian Weimer
On 06/08/2018 04:34 AM, Ram Pai wrote: So the remaining question at this point is whether the Intel behavior (default-deny instead of default-allow) is preferable. Florian, remind me what behavior needs to fixed? See the other thread. The Intel register equivalent to the AMR by default

Re: pkeys on POWER: Access rights not reset on execve

2018-06-07 Thread Ram Pai
> > So the remaining question at this point is whether the Intel > behavior (default-deny instead of default-allow) is preferable. Florian, remind me what behavior needs to fixed? -- Ram Pai

Re: pkeys on POWER: Access rights not reset on execve

2018-06-04 Thread Florian Weimer
On 06/04/2018 09:02 PM, Ram Pai wrote: On Mon, Jun 04, 2018 at 07:57:46PM +0200, Florian Weimer wrote: On 06/04/2018 04:01 PM, Ram Pai wrote: On Mon, Jun 04, 2018 at 12:12:07PM +0200, Florian Weimer wrote: On 06/03/2018 10:18 PM, Ram Pai wrote: On Mon, May 21, 2018 at 01:29:11PM +0200,

Re: pkeys on POWER: Access rights not reset on execve

2018-06-04 Thread Ram Pai
On Mon, Jun 04, 2018 at 07:57:46PM +0200, Florian Weimer wrote: > On 06/04/2018 04:01 PM, Ram Pai wrote: > >On Mon, Jun 04, 2018 at 12:12:07PM +0200, Florian Weimer wrote: > >>On 06/03/2018 10:18 PM, Ram Pai wrote: > >>>On Mon, May 21, 2018 at 01:29:11PM +0200, Florian Weimer wrote: > On

Re: pkeys on POWER: Access rights not reset on execve

2018-06-04 Thread Florian Weimer
On 06/04/2018 04:01 PM, Ram Pai wrote: On Mon, Jun 04, 2018 at 12:12:07PM +0200, Florian Weimer wrote: On 06/03/2018 10:18 PM, Ram Pai wrote: On Mon, May 21, 2018 at 01:29:11PM +0200, Florian Weimer wrote: On 05/20/2018 09:11 PM, Ram Pai wrote: Florian, Does the following patch fix

Re: pkeys on POWER: Access rights not reset on execve

2018-06-04 Thread Ram Pai
On Mon, Jun 04, 2018 at 12:12:07PM +0200, Florian Weimer wrote: > On 06/03/2018 10:18 PM, Ram Pai wrote: > >On Mon, May 21, 2018 at 01:29:11PM +0200, Florian Weimer wrote: > >>On 05/20/2018 09:11 PM, Ram Pai wrote: > >>>Florian, > >>> > >>> Does the following patch fix the problem for you? Just

Re: pkeys on POWER: Access rights not reset on execve

2018-06-04 Thread Florian Weimer
On 06/03/2018 10:18 PM, Ram Pai wrote: On Mon, May 21, 2018 at 01:29:11PM +0200, Florian Weimer wrote: On 05/20/2018 09:11 PM, Ram Pai wrote: Florian, Does the following patch fix the problem for you? Just like x86 I am enabling all keys in the UAMOR register during

Re: pkeys on POWER: Access rights not reset on execve

2018-06-03 Thread Ram Pai
On Mon, May 21, 2018 at 01:29:11PM +0200, Florian Weimer wrote: > On 05/20/2018 09:11 PM, Ram Pai wrote: > >Florian, > > > > Does the following patch fix the problem for you? Just like x86 > > I am enabling all keys in the UAMOR register during > > initialization itself. Hence any key

Re: pkeys on POWER: Access rights not reset on execve

2018-05-21 Thread Florian Weimer
On 05/20/2018 09:11 PM, Ram Pai wrote: Florian, Does the following patch fix the problem for you? Just like x86 I am enabling all keys in the UAMOR register during initialization itself. Hence any key created by any thread at any time, will get activated on all

Re: pkeys on POWER: Access rights not reset on execve

2018-05-20 Thread Ram Pai
On Sat, May 19, 2018 at 11:06:20PM -0700, Andy Lutomirski wrote: > On Sat, May 19, 2018 at 11:04 PM Ram Pai wrote: > > > On Sat, May 19, 2018 at 04:47:23PM -0700, Andy Lutomirski wrote: > On > Sat, May 19, 2018 at 1:28 PM Ram Pai wrote: > > >

Re: pkeys on POWER: Access rights not reset on execve

2018-05-20 Thread Andy Lutomirski
On Sat, May 19, 2018 at 11:04 PM Ram Pai wrote: > On Sat, May 19, 2018 at 04:47:23PM -0700, Andy Lutomirski wrote: > On Sat, May 19, 2018 at 1:28 PM Ram Pai wrote: > ...snip... > > > > So is it possible for two threads to each call pkey_alloc() and end

Re: pkeys on POWER: Access rights not reset on execve

2018-05-20 Thread Ram Pai
On Sat, May 19, 2018 at 04:47:23PM -0700, Andy Lutomirski wrote: > On Sat, May 19, 2018 at 1:28 PM Ram Pai wrote: ...snip... > > So is it possible for two threads to each call pkey_alloc() and end up with > the same key? If so, it seems entirely broken. No. Two threads

Re: pkeys on POWER: Access rights not reset on execve

2018-05-19 Thread Andy Lutomirski
On Sat, May 19, 2018 at 1:28 PM Ram Pai wrote: > You got it mostly right. Filling in some more details below for > completeness. > [...] Okay, so I guess I was correct as to what the functionality was but not as to the encoding or the name of UAMOR. Can you also confirm

Re: pkeys on POWER: Access rights not reset on execve

2018-05-19 Thread Ram Pai
On Fri, May 18, 2018 at 06:50:39PM -0700, Andy Lutomirski wrote: > On Fri, May 18, 2018 at 6:19 PM Ram Pai wrote: > > > However the fundamental issue is still the same, as mentioned in the > > other thread. > > > "Should the permissions on a key be allowed to be changed, if

Re: pkeys on POWER: Access rights not reset on execve

2018-05-19 Thread Florian Weimer
On 05/19/2018 03:19 AM, Ram Pai wrote: The issue you may be talking about here is that -- "when you set the AMR register to 0x, it just sets it to 0x0c00." To me it looks like, exec/fork are not related to the issue. Or are they also somehow connected to the issue?

Re: pkeys on POWER: Access rights not reset on execve

2018-05-18 Thread Florian Weimer
On 05/19/2018 03:50 AM, Andy Lutomirski wrote: Now another thread calls pkey_alloc(), so UAMR is asynchronously changed, and the thread will write zero to the relevant AMR bits. If I understand correctly, this means that the decision to mask off unallocated keys via UAMR effectively forces the

Re: pkeys on POWER: Access rights not reset on execve

2018-05-18 Thread Florian Weimer
On 05/19/2018 03:19 AM, Ram Pai wrote: New AMR value (PID 112291, before execl): 0x0c00 AMR (PID 112291): 0x0c00 The issue is here. The second line is after the execl (printed from the start of main), and the AMR value is not reset to zero. Allocated key (PID

Re: pkeys on POWER: Access rights not reset on execve

2018-05-18 Thread Andy Lutomirski
On Fri, May 18, 2018 at 6:19 PM Ram Pai wrote: > However the fundamental issue is still the same, as mentioned in the > other thread. > "Should the permissions on a key be allowed to be changed, if the key > is not allocated in the first place?". > my answer is NO. Lets

Re: pkeys on POWER: Access rights not reset on execve

2018-05-18 Thread Ram Pai
On Fri, May 18, 2018 at 04:27:14PM +0200, Florian Weimer wrote: > This test program: > > #include > #include > #include > #include > #include > #include > > /* Return the value of the AMR register. */ > static inline unsigned long int > pkey_read (void) > { > unsigned long int result; >