summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c3
-rw-r--r--sys/kern/kern_pledge.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index d47f2520e4e..8b3f0e5e50d 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.168 2015/10/09 01:10:27 deraadt Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.169 2015/10/10 14:46:15 deraadt Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -280,6 +280,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
* Mark this process as "leave me alone, I'm execing".
*/
atomic_setbits_int(&pr->ps_flags, PS_INEXEC);
+ p->p_pledgenote = TMN_XPATH;
#if NSYSTRACE > 0
if (ISSET(p->p_flag, P_SYSTRACE)) {
diff --git a/sys/kern/kern_pledge.c b/sys/kern/kern_pledge.c
index ef2314ace41..9402d1e98eb 100644
--- a/sys/kern/kern_pledge.c
+++ b/sys/kern/kern_pledge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_pledge.c,v 1.6 2015/10/09 23:55:03 deraadt Exp $ */
+/* $OpenBSD: kern_pledge.c,v 1.7 2015/10/10 14:46:15 deraadt Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -513,6 +513,11 @@ pledge_namei(struct proc *p, char *origpath)
((p->p_p->ps_pledge & PLEDGE_CPATH) == 0))
return (pledge_fail(p, EPERM, PLEDGE_CPATH));
+ /* Doing a permitted execve() */
+ if ((p->p_pledgenote & TMN_XPATH) &&
+ (p->p_p->ps_pledge & PLEDGE_EXEC))
+ return (0);
+
if ((p->p_pledgenote & TMN_WPATH) &&
(p->p_p->ps_pledge & PLEDGE_WPATH) == 0)
return (pledge_fail(p, EPERM, PLEDGE_WPATH));