diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2018-10-30 03:27:46 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2018-10-30 03:27:46 +0000 |
commit | 38fe7826bc28f972c2e9f4bcffbb25ed2dae8f00 (patch) | |
tree | 592c7853c54c81b84f9fd36751a57826320adfc7 /sys/kern/kern_exec.c | |
parent | 87e3b47db8a6939d760727d7fccff7f833fbbfb4 (diff) |
If we execute a #!shell binary, the shell is an integral part of the
binary so it should bypass unveil restrictions. This is similar
(but different...) to how the ELF linker (ld.so) is loaded (after
unveils get dropped). Discovered in doas, due to more accurate unveil
semantics.
ok guenther tedu beck
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 5e5c3de5f41..12351714da3 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.201 2018/08/05 14:23:57 beck Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.202 2018/10/30 03:27:45 deraadt Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -117,6 +117,8 @@ check_exec(struct proc *p, struct exec_package *epp) ndp = epp->ep_ndp; ndp->ni_cnd.cn_nameiop = LOOKUP; ndp->ni_cnd.cn_flags = FOLLOW | LOCKLEAF | SAVENAME; + if (epp->ep_flags & EXEC_INDIR) + ndp->ni_cnd.cn_flags |= BYPASSUNVEIL; /* first get the vnode */ if ((error = namei(ndp)) != 0) return (error); |