sys/kern/kern_prot.c
/*-
 * Determine whether td may deliver the specified signal to p.
 * Returns: 0 for permitted, an errno value otherwise
 * Locks: Sufficient locks to protect various components of td and p
 *        must be held.  td must be curthread, and a lock must be
 *        held for p.
 * References: td and p must be valid for the lifetime of the call
 */
Determine whether td may deliver the specified signal to p.
Returns: 0 for permitted, an errno value otherwise
Locks: Sufficient locks to protect various components of td and p
must be held.  td must be curthread, and a lock must be
held for p.
References: td and p must be valid for the lifetime of the call
Determine whether td may deliver the specified signal to p . Returns : 0 for permitted an errno value otherwise Locks : Sufficient locks to protect various components of td and p must be held . td must be curthread and a lock must be held for p . References : td and p must be valid for the lifetime of the call
int
p_cansignal(struct thread *td, struct proc *p, int signum)
{
	KASSERT(td == curthread, ("%s: td not curthread", __func__));
	PROC_LOCK_ASSERT(p, MA_OWNED);
	if (td->td_proc == p)
		return (0);
	if (signum == SIGCONT && td->td_proc->p_session == p->p_session)
		return (0);
	if (td->td_proc->p_leader != NULL && signum >= SIGTHR &&
	    signum < SIGTHR + 4 && td->td_proc->p_leader == p->p_leader)
		return (0);
	return (cr_cansignal(td->td_ucred, p, signum));
}
int p_cansignal ( struct thread * td , struct proc * p , int signum ) { KASSERT ( td == curthread , ( " " , __func__ ) ) ; PROC_LOCK_ASSERT ( p , MA_OWNED ) ; if ( td -> td_proc == p ) return ( 0 ) ; if ( signum == SIGCONT && td -> td_proc -> p_session == p -> p_session ) return ( 0 ) ; if ( td -> td_proc -> p_leader != NULL && signum >= SIGTHR && signum < SIGTHR + 4 && td -> td_proc -> p_leader == p -> p_leader ) return ( 0 ) ; return ( cr_cansignal ( td -> td_ucred , p , signum ) ) ; }
Determine whether td may deliver the specified signal to p.
 Returns: 0 for permitted, an errno value otherwise
 Locks: Sufficient locks to protect various components of td and p
        must be held.
Determine whether td may deliver the specified signal to p . Returns : 0 for permitted an errno value otherwise Locks : Sufficient locks to protect various components of td and p must be held .
/*
	 * UNIX signalling semantics require that processes in the same
	 * session always be able to deliver SIGCONT to one another,
	 * overriding the remaining protections.
	 */ /* XXX: This will require an additional lock of some sort. */ /*
	 * Some compat layers use SIGTHR and higher signals for
	 * communication between different kernel threads of the same
	 * process, so that they expect that it's always possible to
	 * deliver them, even for suid applications where cr_cansignal() can
	 * deny such ability for security consideration.  It should be
	 * pretty safe to do since the only way to create two processes
	 * with the same p_leader is via rfork(2).
	 */