From owner-freebsd-questions Thu May 24 18:28:26 2001 Delivered-To: freebsd-questions@freebsd.org Received: from www.medsp.com (wannabe.guru.org [209.203.250.44]) by hub.freebsd.org (Postfix) with ESMTP id EFEFF37B43E; Thu, 24 May 2001 18:28:10 -0700 (PDT) (envelope-from scott@www.medsp.com) Received: (from scott@localhost) by www.medsp.com (8.11.1/8.9.3) id f4P1Q4a15014; Thu, 24 May 2001 18:26:04 -0700 (PDT) (envelope-from scott) Date: Thu, 24 May 2001 18:26:03 -0700 From: Scott Gasch To: questions@freebsd.org Cc: hackers@freebsd.org Subject: memory protection question Message-ID: <20010524182603.A14984@www.medsp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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