From: deraadt Date: Sat, 10 Oct 2015 19:12:39 +0000 (+0000) Subject: pid 0 also implies self, so allow that for the pledge case. Found in X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e420f7bd85d6698d7d0d8a2127cd4d7c289dbe62;p=openbsd pid 0 also implies self, so allow that for the pledge case. Found in a refactoring being done for the bc/dc relationship with otto. --- diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index e4a17024f77..536c41f1ce5 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.185 2015/10/09 23:55:03 deraadt Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.186 2015/10/10 19:12:39 deraadt Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -572,7 +572,8 @@ sys_kill(struct proc *cp, void *v, register_t *retval) if (cp->p_p->ps_flags & PS_PLEDGE) { /* PLEDGE_PROC is required to signal another pid */ - if ((cp->p_p->ps_pledge & PLEDGE_PROC) || pid == cp->p_pid) + if ((cp->p_p->ps_pledge & PLEDGE_PROC) || + pid == cp->p_pid || pid == 0) ; else return pledge_fail(cp, EPERM, PLEDGE_SELF);