|MPROTECT(2)||System Calls Manual||MPROTECT(2)|
*addr, size_t len,
mprotect() system call sets the access protections for the pages that contain the address range addr through addr + len - 1 (inclusive). If len is 0, no action is taken on the page that contains addr.
The protections (region accessibility) are specified in the
prot argument. It should either be
PROT_NONE (no permissions) or the bitwise OR of one
or more of the following values:
Not all implementations will guarantee protection on a page basis;
the granularity of protection changes may be as large as an entire region.
Nor will all implementations guarantee to give exactly the requested
permissions; more permissions may be granted than requested by
prot. However, if
was not specified then the page will not be writable.
mprotect() will fail if:
mlockall(MCL_FUTURE), a page being protected is not currently accessible, and making it accessible and locked would exceed process or system limits.
PROT_EXECmappings are not permitted in most binaries (see
kern.wxabortin sysctl(2) for more information).
mprotect() function conforms to IEEE Std 1003.1-2008 (“POSIX.1”).
mprotect() function first appeared in 4.4BSD.
mprotect() does not require addr to be page-aligned, although other implementations may.
|January 11, 2019||OpenBSD-current|