From: Paul Mackerras <paulus@ozlabs.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: benh@kernel.crashing.org, mpe@ellerman.id.au,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH 2/2] powerpc/mm: Replace _PAGE_USER with _PAGE_PRIV
Date: Sat, 5 Mar 2016 21:41:25 +1100 [thread overview]
Message-ID: <20160305104125.GA4175@fergus.ozlabs.ibm.com> (raw)
In-Reply-To: <87lh5xs4z5.fsf@linux.vnet.ibm.com>
On Sat, Mar 05, 2016 at 01:59:02PM +0530, Aneesh Kumar K.V wrote:
> Paul Mackerras <paulus@ozlabs.org> writes:
>
> > [ text/plain ]
> > On Fri, Feb 26, 2016 at 08:50:50AM +0530, Aneesh Kumar K.V wrote:
> >> _PAGE_PRIV means the page can be accessed only by kernel. This is done
> >> to keep pte bits similar to PowerISA 3.0 radix PTE format. User
> >> pages are now makred by clearing _PAGE_PRIV bit.
> >
> >
>
> .....
>
> >> @@ -40,6 +40,11 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
> >> if (unlikely(access & ~old_pte))
> >> return 1;
> >
> > This check is going to do a different thing now as far as
> > _PAGE_USER/_PAGE_PRIV is concerned: previously it would prevent a
> > non-privileged access to a privileged page from creating a HPTE, now
> > it prevents a privileged access to a non-privileged page from creating
> > a HPTE. A privileged access means an access by the kernel to a high
> > address, and arguably we would never have a non-privileged PTE at a
> > high (i.e. kernel) address, but it's still a semantic change that
> > should have been flagged in the patch description.
>
>
> We don't set _PAGE_PRIVILGED when we have a privilged acess to a non
> privilged page. We set it as below (with updated comments)
>
> /*
> * We set _PAGE_PRIVILEGED only when
> * kernel mode access kernel space.
> *
> * _PAGE_PRIVILGED is NOT set
> * 1) when kernel mode access user space
> * 2) user space access kernel space.
> */
> if (!(msr & MSR_PR) && !(REGION_ID(ea) == USER_REGION_ID))
> access |= _PAGE_PRIVILEGED;
You're confusing a page in the user part of the address space with a
non-privileged page. Now, we would certainly expect that all pages in
the user part of the address space would be non-privileged pages and
all pages in the kernel part would be privileged pages, but nothing
actually enforces that. The semantic change is that if we did somehow
happen to have a non-privileged page (one without _PAGE_PRIVILEGED
set) in the kernel part of the address space, we can no longer access
it from the kernel. Now you can argue that we never have
non-privileged pages in the kernel part of the address space, and so
the change doesn't matter. That is probably a good argument, but you
do need to mention the change and make that argument in your patch
description.
Paul.
next prev parent reply other threads:[~2016-03-05 10:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 3:20 [RFC PATCH 1/2] powerpc/mm: Update prot_none implementation using _PAGE_READ Aneesh Kumar K.V
2016-02-26 3:20 ` [RFC PATCH 2/2] powerpc/mm: Replace _PAGE_USER with _PAGE_PRIV Aneesh Kumar K.V
2016-02-29 2:36 ` Benjamin Herrenschmidt
2016-02-29 7:49 ` Aneesh Kumar K.V
2016-03-02 1:07 ` Paul Mackerras
2016-03-05 8:29 ` Aneesh Kumar K.V
2016-03-05 10:41 ` Paul Mackerras [this message]
2016-03-02 0:38 ` [RFC PATCH 1/2] powerpc/mm: Update prot_none implementation using _PAGE_READ Paul Mackerras
2016-03-02 1:39 ` Paul Mackerras
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=20160305104125.GA4175@fergus.ozlabs.ibm.com \
--to=paulus@ozlabs.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).