lkml.org 
[lkml]   [2004]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] (IA64) Fix ugly __[PS]* macros in <asm-ia64/pgtable.h>
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [from the cache]
©2003-2011 Jasper Spaans