public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: linux-kernel@vger.kernel.org
Cc: David Mosberger-Tang <davidm@hpl.hp.com>,
	linux-ia64@linuxia64.org, Matthew Wilcox <matthew@wil.cx>,
	Grant Grundler <grundler@parisc-linux.org>,
	parisc-linux@parisc-linux.org,
	Richard Curnow <Richard.Curnow@superh.com>,
	Paul Mundt <lethal@linux-sh.org>,
	linuxsh-shmedia-dev@lists.sourceforge.net,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Subject: Comparing PROT_EXEC-only pages on different CPUs
Date: Thu, 1 Jul 2004 23:40:16 +0100	[thread overview]
Message-ID: <20040701224016.GB7928@mail.shareable.org> (raw)

Alpha and IA64 are the only Linux architecture where PROT_EXEC by
itself results in exec-only pages.  Interestingly, the hardware of
some other architectures _could_ implement exec-only pages, but they
chose not to:

    The PA-RISC pgtable.h says:

        "We could have an execute only page using "gateway - promote
	to priv level 3", but that is kind of silly. So, the way
	things are defined now, we must always have read permission
	for pages with execute permission. For the fun of it we'll go
	ahead and support write only pages."

    Richard Curnow working on the SH64 port says:

        "Although the hardware is capable of distinguish R and X, the kernel
        always allows R if X is specified to mmap().  This is for 2 reasons :

           1. jump tables for switch() get embedded into the code in
              32-bit (SHmedia) mode
           2. constant pools embedded in the code in 16-bit
              (SHcompact, i.e. SH-4 compatible) mode

        so in practice an exec-only page is pretty useless to a
        typical userland program."

Richard raises an interesting point: exec-only pages are useless if
the code needs to read jump tables and constant pools.  It seems very
likely Alpha and IA64 have these.

The point is: should the automatic addition of read permission be
kernel policy (as on SH64 and PA-RISC), or should it be for userspace
policy to get right as real code probably needs it (as on Alpha and IA64)?

Does anyone think there's a "right" behaviour which current
or future Linux ports should try to conform to?  Should any of the
current ones be changed?

I'm just making sure all 4 know about each others behaviour before I
wash my hands of this observation. :)

Cheers,
-- Jamie

             reply	other threads:[~2004-07-01 22:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01 22:40 Jamie Lokier [this message]
2004-07-02  1:36 ` Comparing PROT_EXEC-only pages on different CPUs Richard Henderson
2004-07-02  4:02   ` Jamie Lokier
2004-07-02 14:51     ` Richard Curnow
2004-07-02  3:24 ` [parisc-linux] " John David Anglin
2004-07-02  4:07   ` Jamie Lokier
2004-07-03  0:39     ` John David Anglin

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=20040701224016.GB7928@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=Richard.Curnow@superh.com \
    --cc=davidm@hpl.hp.com \
    --cc=grundler@parisc-linux.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=lethal@linux-sh.org \
    --cc=linux-ia64@linuxia64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxsh-shmedia-dev@lists.sourceforge.net \
    --cc=matthew@wil.cx \
    --cc=parisc-linux@parisc-linux.org \
    --cc=rth@twiddle.net \
    /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