diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-11-01 19:03:34 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-11-01 19:03:34 +0000 |
commit | 68511280041637921c144dadc66364bd3847520e (patch) | |
tree | 8837690b527988d8389c4243559c191b02100459 /sys/kern/kern_sig.c | |
parent | b249aebdcb012545f1aa7bab683224c46dc508fc (diff) |
refactor pledge_*_check and pledge_fail functions
- rename _check function without suffix: a "pledge" function called from
anywhere is a "check" function.
- makes pledge_fail call the responsability to the _check function. remove it
from caller.
- make proper use of (potential) returned error of _check() functions.
- adds pledge_kill() and pledge_protexec()
with and OK deraadt@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 677a35e3da5..7f49043214a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.187 2015/10/25 20:39:54 deraadt Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.188 2015/11/01 19:03:33 semarie Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -569,16 +569,10 @@ sys_kill(struct proc *cp, void *v, register_t *retval) struct proc *p; int pid = SCARG(uap, pid); int signum = SCARG(uap, signum); + int error; - 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 || pid == 0) - ; - else - return pledge_fail(cp, EPERM, PLEDGE_PROC); - } - + if ((error = pledge_kill(cp, pid)) != 0) + return (error); if (((u_int)signum) >= NSIG) return (EINVAL); if (pid > 0) { |