Re: Testing PROT_NONE and other protections, and a surprise

From: Russell King
Date: Thu Jul 01 2004 - 07:53:56 EST


On Thu, Jul 01, 2004 at 04:26:06AM +0100, Jamie Lokier wrote:
> When running it on i386, I got a *huge* surprise (to me). A
> PROT_WRITE-only page can sometimes fault on read or exec. This is the
> output:
>
> Requested PROT | --- R-- -W- RW- --X R-X -WX RWX
> ========================================================================
> MAP_SHARED | --- r-x !w! rwx r-x r-x rwx rwx
> MAP_PRIVATE | --- r-x !w! rwx r-x r-x rwx rwx
>
> The "!" means that a read or exec *sometimes* raises a signal.

Here are the ARM results:

Requested PROT | --- R-- -W- RW- --X R-X -WX RWX
========================================================================
MAP_SHARED | --- r-x !w! rwx r-x r-x rwx rwx
MAP_PRIVATE | --- r-x !w! rwx r-x r-x rwx rwx

As expected, the same as x86 since we have the same situation there -
we can not represent the write-only page permission in hardware.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/