summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2014-07-07 05:31:42 +0000
committermatthew <matthew@openbsd.org>2014-07-07 05:31:42 +0000
commitdbe36602fde69d76502f8f38827897a96f843514 (patch)
tree54f0880b68150a5d65a6f47fde5eecec416cdff0
parentregen (diff)
downloadwireguard-openbsd-dbe36602fde69d76502f8f38827897a96f843514.tar.xz
wireguard-openbsd-dbe36602fde69d76502f8f38827897a96f843514.zip
fork1: FORK_THREAD requires FORK_SHAREFILES
Now that file descriptor tables have moved from a per-thread resource to per-process, it's impossible to fork a thread without sharing the file descriptor table. ok guenther
-rw-r--r--share/man/man9/fork1.96
-rw-r--r--sys/kern/kern_fork.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/share/man/man9/fork1.9 b/share/man/man9/fork1.9
index f0f28b6d852..1167c141a3f 100644
--- a/share/man/man9/fork1.9
+++ b/share/man/man9/fork1.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fork1.9,v 1.24 2014/07/01 05:53:13 jmc Exp $
+.\" $OpenBSD: fork1.9,v 1.25 2014/07/07 05:31:42 matthew Exp $
.\" $NetBSD: fork1.9,v 1.3 1999/03/16 00:40:47 garbled Exp $
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: July 1 2014 $
+.Dd $Mdocdate: July 7 2014 $
.Dt FORK1 9
.Os
.Sh NAME
@@ -119,7 +119,7 @@ ptrace(PT_TRACE_ME, 0, 0, 0) had been invoked in the child.
.It Dv FORK_THREAD
The child will instead be a kernel-level thread in the same process
as the parent.
-.Dv FORK_NOZOMBIE ,
+.Dv FORK_SHAREFILES ,
.Dv FORK_SHAREVM ,
and
.Dv FORK_SIGHAND
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 859a2bcdfdc..40760e1999d 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.168 2014/07/04 05:58:30 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.169 2014/07/07 05:31:42 matthew Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -253,7 +253,9 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr,
/* sanity check some flag combinations */
if (flags & FORK_THREAD) {
- if ((flags & FORK_SIGHAND) == 0 || (flags & FORK_SYSTEM) != 0)
+ if ((flags & FORK_SHAREFILES) == 0 ||
+ (flags & FORK_SIGHAND) == 0 ||
+ (flags & FORK_SYSTEM) != 0)
return (EINVAL);
}
if (flags & FORK_SIGHAND && (flags & FORK_SHAREVM) == 0)