mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Jamie Lokier <jamie@shareable.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@lists.linuxppc.org,
	Anton Blanchard <anton@au.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: A question about PROT_NONE on PPC and PPC64
Date: Wed, 30 Jun 2004 14:47:52 +1000	[thread overview]
Message-ID: <16610.17912.738648.646334@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <20040630031821.GB25149@mail.shareable.org>

Jamie Lokier writes:

> PPC32
> =====
> 
> In include/asm-ppc/pgtable.h, there's:
> 
> #define PAGE_NONE	__pgprot(_PAGE_BASE)
> #define PAGE_READONLY	__pgprot(_PAGE_BASE | _PAGE_USER)
> 
> It appears the only difference betwen PROT_READ and PROT_NONE is
> whether _PAGE_USER is set.
> 
> Thus PROT_NONE pages aren't readable from userspace, but it appears
> they _are_ readable from kernel space.  Is this correct?

No.  Kernel accesses to pages in the user portion of the address space
(0 .. TASK_SIZE-1) are done using the user permissions.  On classic
PPC this is implemented (in part) by setting Ks = Kp = 1 in the
segment descriptors for the user segments, which tells the hardware to
check the access as if it was a user access even in supervisor mode.

We do the same on ppc64 as well.

> So does this mean that PROT_NONE pages, although they aren't readable
> from userspace, are readable from kernel space?  I.e. that write()
> with a PROT_NONE region would succeed, instead of returning EFAULT as
> it should?

If you do find a ppc32 or ppc64 machine where the write succeeds
instead of returning EFAULT, let me know please.

Paul.

  reply	other threads:[~2004-06-30  4:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-30  3:18 Jamie Lokier
2004-06-30  4:47 ` Paul Mackerras [this message]
     [not found] ` <20040705072731.GB19707@iram.es>
     [not found]   ` <20040705142046.GB3411@mail.shareable.org>
     [not found]     ` <20040705155908.GA23163@iram.es>
2004-07-05 19:11       ` Jamie Lokier

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=16610.17912.738648.646334@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=anton@au.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=jamie@shareable.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /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

all inboxes | Powered by JetHome®