From ccc5092ed235f06c1e85aa2008acbdbbcd0a9daf Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 3 Mar 2011 20:46:16 +0000 Subject: [PATCH] Do not restrict the siginfo a process sends to itself in any way, but keep restrictions for foreign processes. This is needed to allow raising of full SIGFPE siginfo from softfloat libraries for example. --- sys/kern/sys_sig.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/kern/sys_sig.c b/sys/kern/sys_sig.c index 47b43fb35b45..558262e4fb90 100644 --- a/sys/kern/sys_sig.c +++ b/sys/kern/sys_sig.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_sig.c,v 1.31 2011/02/03 21:45:32 joerg Exp $ */ +/* $NetBSD: sys_sig.c,v 1.32 2011/03/03 20:46:16 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.31 2011/02/03 21:45:32 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.32 2011/03/03 20:46:16 martin Exp $"); #include #include @@ -223,20 +223,22 @@ kill1(struct lwp *l, pid_t pid, ksiginfo_t *ksi, register_t *retval) if ((u_int)ksi->ksi_signo >= NSIG) return EINVAL; - if (ksi->ksi_pid != l->l_proc->p_pid) - return EPERM; + if (pid != l->l_proc->p_pid) { + if (ksi->ksi_pid != l->l_proc->p_pid) + return EPERM; - if (ksi->ksi_uid != kauth_cred_geteuid(l->l_cred)) - return EPERM; + if (ksi->ksi_uid != kauth_cred_geteuid(l->l_cred)) + return EPERM; - switch (ksi->ksi_code) { - case SI_USER: - case SI_QUEUE: - break; - default: - return EPERM; + switch (ksi->ksi_code) { + case SI_USER: + case SI_QUEUE: + break; + default: + return EPERM; + } } - + if (pid > 0) { /* kill single process */ mutex_enter(proc_lock);