On Fri, 3 Jun 2011, Rainer Orth wrote:
> * FreeBSD uses the unmodified address passed to __enable_execute_stack
> to call mprocted, while all others round both address and size to a
> pagesize boundary. I cannot imagine that FreeBSD supports
> byte-granularity mprotect, so this seems an oversight.
The man page of mprotect on FreeBSD 9 (the next release) states the
following which seems supportive of your theory:
NAME
mprotect -- control the protection of pages
:
DESCRIPTION
The mprotect() system call changes the specified pages to have protection
prot. Not all implementations will guarantee protection on a page basis;
the granularity of protection changes may be as large as an entire
region. A region is the virtual address space defined by the start and
end addresses of a struct vm_map_entry.
Gerald