summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-10-14 14:39:04 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-10-14 14:39:04 +0000
commit0b7c9874b856b5d5c14cfb541d23e27530bbc7f9 (patch)
tree3158dc549be84450171b920369e1f859dd8cb004
parentedecffea86bc87b08aa3712d73ee5699b8fd2018 (diff)
Disable fd sharing for this release. Sorry.
deraadt@ ok.
-rw-r--r--lib/libc/sys/rfork.27
-rw-r--r--share/man/man4/options.410
-rw-r--r--sys/kern/kern_fork.c9
3 files changed, 23 insertions, 3 deletions
diff --git a/lib/libc/sys/rfork.2 b/lib/libc/sys/rfork.2
index dfc8313953f..39cda812b45 100644
--- a/lib/libc/sys/rfork.2
+++ b/lib/libc/sys/rfork.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rfork.2,v 1.15 2000/10/18 05:12:11 aaron Exp $
+.\" $OpenBSD: rfork.2,v 1.16 2001/10/14 14:39:03 art Exp $
.\"
.\" This manual page is taken directly from Plan9, and modified to
.\" describe the actual OpenBSD implementation. Permission for
@@ -52,6 +52,11 @@ If set, the invoker's file descriptor table (see
.Xr intro 2 )
is copied; otherwise the two processes share a
single table.
+This flag is currently disabled in the kernel for security reasons and needs
+a special kernel compile option to work.
+Please consult
+.Xr options 4
+for information about the RFORK_FDSHARE option.
.It Dv RFCFDG
If set, the new process starts with a clean file descriptor table.
Is mutually exclusive with
diff --git a/share/man/man4/options.4 b/share/man/man4/options.4
index 8a8b8d4876b..6afef675a0c 100644
--- a/share/man/man4/options.4
+++ b/share/man/man4/options.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: options.4,v 1.84 2001/10/05 14:45:53 mpech Exp $
+.\" $OpenBSD: options.4,v 1.85 2001/10/14 14:39:03 art Exp $
.\" $NetBSD: options.4,v 1.21 1997/06/25 03:13:00 thorpej Exp $
.\"
.\" Copyright (c) 1998 Theo de Raadt
@@ -996,6 +996,14 @@ status can still be obtained using
.Xr apm 8
and/or
.Xr apmd 8 .
+.It Cd RFORK_FDSHARE
+This option enables sharing of filedescriptor tables between processes that
+request it.
+It is needed for the
+.Xr rfork
+system call to work properly and for some programs run under Linux emulation.
+It's disabled by default for security reasons because it allows any malicious
+user to crash the system.
.El
.\" The following requests should be uncommented and used where appropriate.
.\" .Sh FILES
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 20921bd35d7..38fae5329ea 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.43 2001/09/19 20:50:58 mickey Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.44 2001/10/14 14:39:03 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -152,6 +152,13 @@ fork1(p1, exitsig, flags, stack, stacksize, retval)
extern void endtsleep __P((void *));
extern void realitexpire __P((void *));
+#ifndef RFORK_FDSHARE
+ /* XXX - Too dangerous right now. */
+ if (flags & FORK_SHAREFILES) {
+ return (EOPNOTSUPP);
+ }
+#endif
+
/*
* Although process entries are dynamically created, we still keep
* a global limit on the maximum number we will create. We reserve