linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Ram Pai <linuxram@us.ibm.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
	benh@kernel.crashing.org, paulus@samba.org,
	aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com,
	hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com,
	fweimer@redhat.com, msuchanek@suse.com,
	Ulrich.Weigand@de.ibm.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3] powerpc, pkey: make protection key 0 less special
Date: Fri, 4 May 2018 13:21:14 -0700	[thread overview]
Message-ID: <20180504202114.GA5867@ram.oc3035372033.ibm.com> (raw)
In-Reply-To: <373dffe1-4752-5eb0-f97c-a06fe0e0fdb5@intel.com>

On Fri, May 04, 2018 at 12:59:27PM -0700, Dave Hansen wrote:
> On 05/04/2018 12:22 PM, Ram Pai wrote:
> > @@ -407,9 +414,6 @@ static bool pkey_access_permitted(int pkey, bool write, bool execute)
> >  	int pkey_shift;
> >  	u64 amr;
> >  
> > -	if (!pkey)
> > -		return true;
> > -
> >  	if (!is_pkey_enabled(pkey))
> >  		return true;
> 
> Looks fine to me.  Obviously doesn't have any impact on x86 or the
> generic code.
> 
> One question, though.  Which other check makes up for this removed !pkey
> check?

is_pkey_enabled() does take care of it.  we do not enable userspace to
change permissions on pkey-0. This information is tracked in
UAMOR register.  is_pkey_enabled() refers to UAMOR to determine
if the given key is modifiable by userspace. since UAMOR has the bit
corresponding to key-0 set to 0, is_pkey_enabled(key-0) will return
false. 

The deleted code above, would have done the same job without
referring UAMOR. However having special checks on pkey-0 makes
pkey-0 special. It defeats the purpose of this patch; which is to make
pkey-0 less special :).


-- 
Ram Pai

  reply	other threads:[~2018-05-04 20:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 19:22 [PATCH v3] powerpc, pkey: make protection key 0 less special Ram Pai
2018-05-04 19:59 ` Dave Hansen
2018-05-04 20:21   ` Ram Pai [this message]
2018-05-04 21:26 ` Michal Suchánek
2018-05-04 21:31   ` Dave Hansen
2018-05-04 21:45     ` Ram Pai
2018-05-05 12:39       ` Michal Suchánek
2018-05-06 20:10         ` Ram Pai
2018-05-07 11:21           ` Michal Suchánek
2018-05-08 16:38             ` Ram Pai
2018-05-08 17:03               ` Michal Suchánek
2018-05-08 18:38                 ` Ram Pai
2018-05-09 15:43 ` Michal Suchánek
2018-05-09 15:46   ` Dave Hansen
2018-05-09 15:56     ` Michal Suchánek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180504202114.GA5867@ram.oc3035372033.ibm.com \
    --to=linuxram@us.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=bauerman@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bsingharora@gmail.com \
    --cc=dave.hansen@intel.com \
    --cc=fweimer@redhat.com \
    --cc=hbabu@us.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).