public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: davidm@hpl.hp.com
Cc: linux-ia64@linuxia64.org, "Siddha,
	Suresh B" <suresh.b.siddha@intel.com>,
	Andrew Morton <akpm@osdl.org>, Kurt Garloff <garloff@suse.de>,
	linux-kernel@vger.kernel.org, mingo@redhat.com
Subject: Re: [PATCH] (IA64) Fix ugly __[PS]* macros in <asm-ia64/pgtable.h>
Date: Thu, 15 Apr 2004 16:26:00 +0100	[thread overview]
Message-ID: <20040415152600.GA18331@mail.shareable.org> (raw)
In-Reply-To: <16509.48237.556502.218222@napali.hpl.hp.com>

David Mosberger wrote:
>   >> No, Alpha Linux didn't map data without execute permission.
> 
>   Jamie> That was true from Linux 1.1.67 (when Alpha was introduced)
>   Jamie> to 1.1.84 (when __[PS]* was introduced).  I'm not sure the
>   Jamie> Alpha target even worked during those versions.  Since Linux
>   Jamie> 1.1.84, it has mapped pages on the Alpha without execute
>   Jamie> permission: the _PAGE_FOE (fault on exec) bit is set for
>   Jamie> mappings which don't have PROT_EXEC.
> 
> $ uname -a
> Linux hostname 2.2.20 #2 Wed Mar 20 19:57:28 EST 2002 alpha GNU/Linux
> $ cat /proc/self/maps | grep cat
> 0000000120000000-0000000120006000 r-xp 0000000000000000 08:01 309740     /bin/cat
> 0000000120014000-0000000120016000 rwxp 0000000000004000 08:01 309740     /bin/cat
> 
> As you can see, the data-segment is mapped with EXEC bit turned on.
> Ditto for the stack segment, which I think is this one:
> 
> 000000011fffe000-0000000120000000 rwxp 0000000000000000 00:00 0

Lest we get more wires crossed, the "x" in /proc/self/maps indicates
that userspace _requested_ executable mapping with PROT_EXEC.

It is independent of whether the kernel and hardware can grant a
non-executable mapping.  On my Athlon:

08048000-0804c000 r-xp 00000000 03:02 95153      /bin/cat
0804c000-0804d000 rw-p 00003000 03:02 95153      /bin/cat
bfffe000-c0000000 rwxp fffff000 00:00 0

The stack is mapped executable, and the data segment is mapped
non-executable, according to /proc/self/maps which reflects the
PROT_EXEC request.  But in fact because of hardware limitations,
despite the "rw-p" my data segment is actually executable.

If you map a segment without PROT_EXEC on Alpha, using a kernel newer
than 1.1.84, you'll get a non-executable mapping.  That's what I mean
when I say the Alpha maps data without executable permission.  The ELF
loader appears to ask for exec permission anyway, which is another
thing entirely.

-- Jamie

  reply	other threads:[~2004-04-15 15:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-14  7:28 Non-Exec stack patches Siddha, Suresh B
2004-04-14  8:23 ` Jamie Lokier
2004-04-14  8:35   ` PowerPC exec page protection Jamie Lokier
2004-04-14  8:44     ` Anton Blanchard
2004-04-14  9:35       ` Jamie Lokier
2004-04-14 11:37   ` [PATCH] (IA64) Fix ugly __[PS]* macros in <asm-ia64/pgtable.h> Jamie Lokier
2004-04-14 16:07     ` David Mosberger
2004-04-14 18:46       ` Jamie Lokier
2004-04-14 19:02         ` David Mosberger
2004-04-14 19:14           ` Jamie Lokier
2004-04-14 19:28           ` Jamie Lokier
2004-04-14 20:05             ` David Mosberger
2004-04-14 21:05               ` Jamie Lokier
2004-04-14 22:34                 ` David Mosberger
2004-04-15 15:26                   ` Jamie Lokier [this message]
2004-04-15 17:45                     ` David Mosberger
2004-04-14  9:47 ` Non-Exec stack patches Jamie Lokier
2004-04-14 18:30   ` Kurt Garloff
2004-04-14 20:54     ` Jeff Dike
2004-04-14 18:35 ` Kurt Garloff

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=20040415152600.GA18331@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=akpm@osdl.org \
    --cc=davidm@hpl.hp.com \
    --cc=garloff@suse.de \
    --cc=linux-ia64@linuxia64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=suresh.b.siddha@intel.com \
    /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