Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/mprotect.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 | .\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd February 26, 2020 | .Dd September 3, 2021 | ||||
.Dt MPROTECT 2 | .Dt MPROTECT 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm mprotect | .Nm mprotect | ||||
.Nd control the protection of pages | .Nd control the protection of pages | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In sys/mman.h | .In sys/mman.h | ||||
.Ft int | .Ft int | ||||
.Fn mprotect "void *addr" "size_t len" "int prot" | .Fn mprotect "void *addr" "size_t len" "int prot" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn mprotect | .Fn mprotect | ||||
system call | system call | ||||
changes the specified pages to have protection | changes the specified pages to have protection | ||||
.Fa prot . | .Fa 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 | |||||
.Vt "struct vm_map_entry" . | |||||
.Pp | .Pp | ||||
Currently these protection bits are known, | Currently these protection bits are known, | ||||
which can be combined, OR'd together: | which can be combined, OR'd together: | ||||
.Pp | .Pp | ||||
.Bl -tag -width ".Dv PROT_WRITE" -compact | .Bl -tag -width ".Dv PROT_WRITE" -compact | ||||
.It Dv PROT_NONE | .It Dv PROT_NONE | ||||
No permissions at all. | No permissions at all. | ||||
.It Dv PROT_READ | .It Dv PROT_READ | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |