summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-03-14 21:38:22 +0000
committertedu <tedu@openbsd.org>2013-03-14 21:38:22 +0000
commit0af1a64da7783e3588769a2ef08b4d6d1515c629 (patch)
treeb6562f472cd08594c600d85e3a77661a303184fd
parent- some indent fixes (diff)
downloadwireguard-openbsd-0af1a64da7783e3588769a2ef08b4d6d1515c629.tar.xz
wireguard-openbsd-0af1a64da7783e3588769a2ef08b4d6d1515c629.zip
the 5.1 era tfork syscall claws its way out of the grave. we failed to
fully deprecate it (notably the go port was still using it as of 5.3) so to give users a little more time to update, __tfork51 lives again. okish deraadt guenther
-rw-r--r--sys/kern/kern_fork.c27
-rw-r--r--sys/kern/syscalls.master4
-rw-r--r--sys/sys/unistd.h9
3 files changed, 36 insertions, 4 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index b3e658c3692..02bc078a951 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.144 2013/03/02 07:05:17 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.145 2013/03/14 21:38:22 tedu Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -141,6 +141,31 @@ sys___tfork(struct proc *p, void *v, register_t *retval)
tfork_child_return, param.tf_tcb, retval, NULL));
}
+#ifdef COMPAT_O51
+int
+compat_o51_sys___tfork(struct proc *p, void *v, register_t *retval)
+{
+ struct compat_o51_sys___tfork_args /* {
+ syscallarg(struct __tfork51) *param;
+ } */ *uap = v;
+ struct __tfork51 param;
+ int flags;
+ int error;
+
+ if ((error = copyin(SCARG(uap, param), &param, sizeof(param))))
+ return (error);
+
+ if (param.tf_flags != 0)
+ return (EINVAL);
+
+ flags = FORK_TFORK | FORK_THREAD | FORK_SIGHAND | FORK_SHAREVM
+ | FORK_NOZOMBIE | FORK_SHAREFILES;
+
+ return (fork1(p, 0, flags, NULL, param.tf_tid, tfork_child_return,
+ param.tf_tcb, retval, NULL));
+}
+#endif
+
void
tfork_child_return(void *arg)
{
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 90e0271a650..fe0a69928aa 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.127 2013/03/02 07:05:18 guenther Exp $
+; $OpenBSD: syscalls.master,v 1.128 2013/03/14 21:38:22 tedu Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -564,6 +564,6 @@
const struct timespec *times, int flag); }
327 STD { int sys_futimens(int fd, \
const struct timespec *times); }
-328 OBSOL otfork51
+328 COMPAT_O51 { int sys___tfork(struct __tfork51 *param); }
329 STD NOLOCK { void sys___set_tcb(void *tcb); }
330 STD NOLOCK { void *sys___get_tcb(void); }
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 94db8ac5021..609bebe8692 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unistd.h,v 1.25 2013/03/02 07:05:18 guenther Exp $ */
+/* $OpenBSD: unistd.h,v 1.26 2013/03/14 21:38:22 tedu Exp $ */
/* $NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $ */
/*
@@ -65,6 +65,13 @@ struct __tfork {
pid_t *tf_tid;
void *tf_stack;
};
+
+/* COMPAT_O51 */
+struct __tfork51 {
+ void *tf_tcb;
+ pid_t *tf_tid;
+ int tf_flags;
+};
#endif
/* the pathconf(2) variable values are part of the ABI */