pid 0 also implies self, so allow that for the pledge case. Found in
authorderaadt <deraadt@openbsd.org>
Sat, 10 Oct 2015 19:12:39 +0000 (19:12 +0000)
committerderaadt <deraadt@openbsd.org>
Sat, 10 Oct 2015 19:12:39 +0000 (19:12 +0000)
a refactoring being done for the bc/dc relationship with otto.

sys/kern/kern_sig.c

index e4a1702..536c41f 100644 (file)
@@ -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);