Hello,

I am on a 4.2-BETA system (yes I know its time to upgrade) and have
question about memory protection.

I am trying to use the mprotect syscall to change the protection of a
page aligned memory buffer (which was allocated with malloc).  The
size of the buffer i want to protect is also a page multiple.

The call succeeds but then appears to have protected more than I asked
for.  In fact I am takign a SIGBUS trying to touch a page about 10
pages before the start of the buffer I passed to mprotect.

I read in the mprotect man page:

  Not all implementations will guarantee protection on a page basis; the
  granularity of protection changes may be as large as an entire
  region.

What does this mean?  What's a region?  Why can't I change the
protection on a per-page basis?  Perhaps another syscall does this?
Do I need to mmap before I mprotect?  Is there any way to do this
without mmapping?

Much appreciate the help,
Scott

-- 
Scott Gasch
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to