lkml.org 
[lkml]   [2004]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Testing PROT_NONE and other protections, and a surprise
Kyle Moffett wrote:
> Just for kicks, I ran this on Mac OS X too :-D Interesting results!
> Requested PROT | --- R-- -W- RW- --X R-X -WX RWX
> ========================================================================
> MAP_SHARED | --- r-x --- rwx --- r-x --- rwx
> MAP_PRIVATE | --- r-x --- rwx --- r-x --- rwx

Yikes. I wonder if those results are correct.

To be honest, if those results are correct it looks like a MacOS X
bug, or at least POSIX non-conformance. It should always grant a
superset of the requested protections.

That invalidates the portability rule "ask for the permissions you
need to use". If you only need to write or execute a file, and you
only ask for those, MacOS X won't let you. So the rule needs to be
"and always include PROT_READ in the list". Assuming it's not a bug
in the test program.

By the way, my program is potentially slightly flaky on architectures
where the CPU can't do byte writes (such as old Alphas). Depending on
the OS, the program might say write access isn't granted for a
write-only request, when it is. The program should've done a word
write instead.

I doubt that is the cause of those results on a PPC running MacOS X though :)

Can you confirm in a simple way that mapping a file, or some anonymous
memory, without PROT_READ, really isn't writable under MacOS X? Can
you confirm it with a word write, if that would be relevant?

Cheers,
-- 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:04    [W:0.207 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site