Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2001 18:26:03 -0700
From:      Scott Gasch <scott@www.medsp.com>
To:        questions@freebsd.org
Cc:        hackers@freebsd.org
Subject:   memory protection question
Message-ID:  <20010524182603.A14984@www.medsp.com>

next in thread | raw e-mail | index | archive | help
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
scott@wannabe.guru.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010524182603.A14984>