[RFC v7 24/25] powerpc: Deliver SEGV signal on pkey violation
Ram Pai
linuxram at us.ibm.com
Wed Oct 18 14:01:14 AEDT 2017
On Wed, Oct 18, 2017 at 01:25:48PM +1100, Balbir Singh wrote:
> On Fri, 18 Aug 2017 15:36:55 -0700
> Ram Pai <linuxram at us.ibm.com> wrote:
>
> > On Sat, Aug 19, 2017 at 07:54:20AM +1000, Benjamin Herrenschmidt wrote:
> > > On Fri, 2017-08-18 at 10:04 -0700, Ram Pai wrote:
> > > > Assume two threads of a task.
> > > >
> > > > T1: mprotect_key(foo, PAGE_SIZE, pkey=4);
> > > > T1: set AMR to disable access for pkey 4;
> > > > T1: key fault
> > > > T2: set AMR to enable access to pkey 4;
> > > > T1: fault handler called.
> > > > This fault handler will see the new AMR and not the
> > > > one at the time of the fault.
> > >
> > > You aren't context switching AMR with the threads ? Ugh... something is
> > > very wrong then.
> >
> > I do store and restore AMR accross context switch. So nevermind; the
> > above problem cannot happen.
> >
>
> I think the assumption is that pkey_alloc() will do the right thing
> while allocating keys across threads
It does. A key allocated to a thread will never be allocated to another
thread.
RP
More information about the Linuxppc-dev
mailing list