On Sat, May 05, 2018 at 02:39:56PM +0200, Michal Suchánek wrote: > On Fri, 4 May 2018 14:45:07 -0700 > Ram Pai <[email protected]> wrote: > > > On Fri, May 04, 2018 at 02:31:10PM -0700, Dave Hansen wrote: > > > On 05/04/2018 02:26 PM, Michal Suchánek wrote: > > > > If it is not ok to change permissions of pkey 0 is it ok to free > > > > it? > > > > > > It's pretty much never OK to free it on x86 or ppc. But, we're not > > > going to put code in to keep userspace from shooting itself in the > > > foot, at least on x86. > > > > and on powerpc aswell. > > But once it's free it can be re-allocated. So you are moving the > special-casing from free code to code dealing with allocation.
Actually if an application frees key-0, it has potentially opened up a can-of-worms. It could step on anything that explodes. Its choice between imposing policies on an application v/s freeing it up to choose its own policy. I think the kernel should impose some form of mild-policy. But others think there should be none. > > If you want something like allocate_exec_only_pkey then the function > (either in kernel or in userspace) needs to make sure it is not > getting/requesting key 0 on powerpc. Yes. makes sense. I will put in some checks towards that. Thanks, RP > > Thanks > > Michal -- Ram Pai
