summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2014-06-13 01:48:51 +0000
committermatthew <matthew@openbsd.org>2014-06-13 01:48:51 +0000
commit7c15f335b2e8baba31f059cf0102f4d0564433b9 (patch)
tree858aa614e7f7293dfd72d33534465dae68dac9fc /lib/libc
parentFix ptrace() hanging hppa MP systems (diff)
downloadwireguard-openbsd-7c15f335b2e8baba31f059cf0102f4d0564433b9.tar.xz
wireguard-openbsd-7c15f335b2e8baba31f059cf0102f4d0564433b9.zip
Add support for MAP_INHERIT_ZERO.
This provides a way for a process to designate pages in its address space that should be replaced by fresh, zero-initialized anonymous memory in forked child processes, rather than being copied or shared. ok jmc, kettenis, tedu, deraadt; positive feedback from many more
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/minherit.240
1 files changed, 24 insertions, 16 deletions
diff --git a/lib/libc/sys/minherit.2 b/lib/libc/sys/minherit.2
index 05ea31c61a4..d6d0784e60c 100644
--- a/lib/libc/sys/minherit.2
+++ b/lib/libc/sys/minherit.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: minherit.2,v 1.13 2007/05/31 19:19:33 jmc Exp $
+.\" $OpenBSD: minherit.2,v 1.14 2014/06/13 01:48:51 matthew Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)minherit.2 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: June 13 2014 $
.Dt MINHERIT 2
.Os
.Sh NAME
@@ -45,12 +45,25 @@ The
.Fn minherit
system call
changes the specified pages to have the inheritance characteristic
-.Fa inherit ,
-which can be set to
-.Dv MAP_INHERIT_NONE ,
-.Dv MAP_INHERIT_COPY ,
-or
-.Dv MAP_INHERIT_SHARE .
+.Fa inherit .
+A page's inheritance characteristic controls how it will be mapped
+in child processes as created by
+.Xr fork 2 .
+.Pp
+The possible inheritance characteristics are:
+.Pp
+.Bl -tag -width MAP_INHERIT_SHARE -offset indent -compact
+.It Dv MAP_INHERIT_NONE
+Pages are not mapped in the child process.
+.It Dv MAP_INHERIT_COPY
+Private copy of pages are mapped in the child process.
+.It Dv MAP_INHERIT_SHARE
+Mapped pages are shared between the parent and child processes.
+.It Dv MAP_INHERIT_ZERO
+New anonymous pages (initialized to all zero bytes)
+are mapped in the child process.
+.El
+.Pp
Not all implementations will guarantee that the inheritance characteristic
can be set on a page basis;
the granularity of changes may be as large as an entire region.
@@ -72,15 +85,10 @@ The virtual address range specified by the
and
.Fa len
arguments is not valid.
-.It Bq Er EACCES
-The flags specified by the
+.It Bq Er EINVAL
+The
.Fa inherit
-argument were not valid for the pages specified
-by the
-.Fa addr
-and
-.Fa len
-arguments.
+argument is invalid.
.El
.Sh SEE ALSO
.Xr madvise 2 ,