summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2018-07-20 07:28:37 +0000
committerBob Beck <beck@cvs.openbsd.org>2018-07-20 07:28:37 +0000
commit96eaba0f2e263febbf0317dc3309721bde756d9d (patch)
treef904b80716906a38c526c132a73895f36d403503 /sys/kern/kern_fork.c
parent7111cf81bdd1078be79190c46ce5fdf29470a3cf (diff)
Correctly copy across unveil's from parent to child process on fork().
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 2e2349ea54c..94ac3ead4ac 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.204 2018/07/13 09:25:23 beck Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.205 2018/07/20 07:28:36 beck Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -75,7 +75,7 @@ pid_t alloctid(void);
pid_t allocpid(void);
int ispidtaken(pid_t);
-struct unveil *unveil_copy(struct process *s, size_t *count);
+void unveil_copy(struct process *parent, struct process *child);
struct proc *thread_new(struct proc *_parent, vaddr_t _uaddr);
struct process *process_new(struct proc *, struct process *, int);
@@ -237,18 +237,9 @@ process_new(struct proc *p, struct process *parent, int flags)
pr->ps_textvp = parent->ps_textvp;
if (pr->ps_textvp)
vref(pr->ps_textvp);
-#if 0 /* XXX Fix this */
+
/* copy unveil if unveil is active */
- if (parent->ps_uvvcount) {
- pr->ps_uvpaths = unveil_copy(parent, &pr->ps_uvncount);
- if (parent->ps_uvpcwd)
- pr->ps_uvpcwd = pr->ps_uvpaths +
- (parent->ps_uvpcwd - parent->ps_uvpaths);
- pr->ps_uvpcwdgone = parent->ps_uvpcwdgone;
- pr->ps_uvdone = parent->ps_uvdone;
- pr->ps_uvshrink = 1;
- }
-#endif
+ unveil_copy(parent, pr);
pr->ps_flags = parent->ps_flags &
(PS_SUGID | PS_SUGIDEXEC | PS_PLEDGE | PS_EXECPLEDGE | PS_WXNEEDED);