Re: Testing PROT_NONE and other protections, and a surprise

Russell King
2004-07-01T12:53:08Z

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