diff options
author | 2018-07-13 09:25:22 +0000 | |
---|---|---|
committer | 2018-07-13 09:25:22 +0000 | |
commit | 8b23add8c74b86d0da67de43302cf21b97b028be (patch) | |
tree | f1c0090b4f820a76d34793eb08027661681a4d3c /sys/kern/kern_fork.c | |
parent | no longer interpret 0.192.168.4 in hosts(5) as 192.168.4/24 (diff) | |
download | wireguard-openbsd-8b23add8c74b86d0da67de43302cf21b97b028be.tar.xz wireguard-openbsd-8b23add8c74b86d0da67de43302cf21b97b028be.zip |
Unveiling unveil(2).
This brings unveil into the tree, disabled by default - Currently
this will return EPERM on all attempts to use it until we are
fully certain it is ready for people to start using, but this
now allows for others to do more tweaking and experimentation.
Still needs to send the unveil's across forks and execs before
fully enabling.
Many thanks to robert@ and deraadt@ for extensive testing.
ok deraadt@
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 291be50d21c..2e2349ea54c 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.203 2018/06/17 08:22:02 anton Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.204 2018/07/13 09:25:23 beck Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -75,6 +75,8 @@ pid_t alloctid(void); pid_t allocpid(void); int ispidtaken(pid_t); +struct unveil *unveil_copy(struct process *s, size_t *count); + struct proc *thread_new(struct proc *_parent, vaddr_t _uaddr); struct process *process_new(struct proc *, struct process *, int); int fork_check_maxthread(uid_t _uid); @@ -235,6 +237,18 @@ 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 pr->ps_flags = parent->ps_flags & (PS_SUGID | PS_SUGIDEXEC | PS_PLEDGE | PS_EXECPLEDGE | PS_WXNEEDED); |