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:
> >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?
>
> I hope I didn't make some stupid mistake in my program, but here it
> is, and here are my results.

Thanks for testing, Kyle.

It looks fine, although this is wrong:

> mem = mmap(0,4096,PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0);
> ...
> if (mem == 0) return 1;

The error code is -1, aka. MAP_FAILED.

> Starting...
> Mapped memory!
> Address is 4000

That's a surprisingly low address.

> Bus error

Phew, I'm glad I decided to catch SIGBUS in the test program at the
last moment...

That's a historical BSD-ism. They can't change it now, because
programs do trap and check for SIGBUS on that platform for protection
violations.

> I'll probably go file a bug with Apple now :-D

It might be a generic *BSD bug (for whatever value of * is used by MacOS X).

That would be interesting to know -- anyone here running *BSD on PPC
or any other architecture to test?

Of course it's an Apple bug as well :)

-- 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.262 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site