summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 87a85a1958d..e4a17024f77 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.184 2015/10/09 01:10:27 deraadt Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.185 2015/10/09 23:55:03 deraadt Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -62,6 +62,7 @@
#include <sys/sched.h>
#include <sys/user.h>
#include <sys/syslog.h>
+#include <sys/pledge.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
@@ -569,6 +570,14 @@ sys_kill(struct proc *cp, void *v, register_t *retval)
int pid = SCARG(uap, pid);
int signum = SCARG(uap, signum);
+ 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)
+ ;
+ else
+ return pledge_fail(cp, EPERM, PLEDGE_SELF);
+ }
+
if (((u_int)signum) >= NSIG)
return (EINVAL);
if (pid > 0) {