FreeBSD kernel kern code
kern_sig.c File Reference
#include <sys/cdefs.h>
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/ctype.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
#include <sys/vnode.h>
#include <sys/acct.h>
#include <sys/capsicum.h>
#include <sys/compressor.h>
#include <sys/condvar.h>
#include <sys/devctl.h>
#include <sys/event.h>
#include <sys/fcntl.h>
#include <sys/imgact.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/ktrace.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/refcount.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/procdesc.h>
#include <sys/ptrace.h>
#include <sys/posix4.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sdt.h>
#include <sys/sbuf.h>
#include <sys/sleepqueue.h>
#include <sys/smp.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/syslog.h>
#include <sys/sysproto.h>
#include <sys/timers.h>
#include <sys/unistd.h>
#include <sys/wait.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/uma.h>
#include <sys/jail.h>
#include <machine/cpu.h>
#include <security/audit/audit.h>

Go to the source code of this file.

Data Structures

struct  sigaction_args
 
struct  sigprocmask_args
 
struct  sigpending_args
 
struct  sigsuspend_args
 
struct  sigaltstack_args
 
struct  killpg1_ctx
 
struct  kill_args
 
struct  sigqueue_args
 
struct  nosys_args
 

Macros

#define ONSIG   32 /* NSIG for osig* syscalls. XXX. */
 
#define CANSIGIO(cr1, cr2)
 
#define SIGPROP_KILL   0x01 /* terminates process by default */
 
#define SIGPROP_CORE   0x02 /* ditto and coredumps */
 
#define SIGPROP_STOP   0x04 /* suspend process */
 
#define SIGPROP_TTYSTOP   0x08 /* ditto, from tty */
 
#define SIGPROP_IGNORE   0x10 /* ignore by default */
 
#define SIGPROP_CONT   0x20 /* continue if suspended */
 
#define _SIG_FOREACH_ADVANCE(i, set)
 
#define SIG_FOREACH(i, set)
 
#define MAX_NUM_CORE_FILES   100000
 
#define NUM_CORE_FILES   5
 
#define GZIP_SUFFIX   ".gz"
 
#define ZSTD_SUFFIX   ".zst"
 
#define corefilename_lock   allproc_lock
 

Enumerations

enum  sigstatus { SIGSTATUS_HANDLE , SIGSTATUS_HANDLED , SIGSTATUS_IGNORE , SIGSTATUS_SBDRY_STOP }
 

Functions

 __FBSDID ("$FreeBSD$")
 
 SDT_PROVIDER_DECLARE (proc)
 
 SDT_PROBE_DEFINE3 (proc,,, signal__send, "struct thread *", "struct proc *", "int")
 
 SDT_PROBE_DEFINE2 (proc,,, signal__clear, "int", "ksiginfo_t *")
 
 SDT_PROBE_DEFINE3 (proc,,, signal__discard, "struct thread *", "struct proc *", "int")
 
static int coredump (struct thread *)
 
static int killpg1 (struct thread *td, int sig, int pgid, int all, ksiginfo_t *ksi)
 
static int issignal (struct thread *td)
 
static void reschedule_signals (struct proc *p, sigset_t block, int flags)
 
static int sigprop (int sig)
 
static void tdsigwakeup (struct thread *, int, sig_t, int)
 
static int sig_suspend_threads (struct thread *, struct proc *, int)
 
static int filt_sigattach (struct knote *kn)
 
static void filt_sigdetach (struct knote *kn)
 
static int filt_signal (struct knote *kn, long hint)
 
static struct thread * sigtd (struct proc *p, int sig, bool fast_sigblock)
 
static void sigqueue_start (void)
 
 SYSCTL_INT (_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, &kern_logsigexit, 0, "Log processes quitting on abnormal signals to syslog(3)")
 
 SYSCTL_INT (_kern, OID_AUTO, forcesigexit, CTLFLAG_RW, &kern_forcesigexit, 0, "Force trap signal to be handled")
 
static SYSCTL_NODE (_kern, OID_AUTO, sigqueue, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "POSIX real time signal")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, max_pending_per_proc, CTLFLAG_RW, &max_pending_per_proc, 0, "Max pending signals per proc")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, preallocate, CTLFLAG_RDTUN, &preallocate_siginfo, 0, "Preallocated signal memory size")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, overflow, CTLFLAG_RD, &signal_overflow, 0, "Number of signals overflew")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, alloc_fail, CTLFLAG_RD, &signal_alloc_fail, 0, "signals failed to be allocated")
 
 SYSCTL_INT (_kern, OID_AUTO, lognosys, CTLFLAG_RWTUN, &kern_lognosys, 0, "Log invalid syscalls")
 
 SYSCTL_BOOL (_kern, OID_AUTO, sigfastblock_fetch_always, CTLFLAG_RWTUN, &sigfastblock_fetch_always, 0, "Fetch sigfastblock word on each syscall entry for proper " "blocking semantic")
 
 SYSCTL_BOOL (_kern, OID_AUTO, sig_discard_ign, CTLFLAG_RWTUN, &kern_sig_discard_ign, 0, "Discard ignored signals on delivery, otherwise queue them to " "the target queue")
 
 SYSINIT (signal, SI_SUB_P1003_1B, SI_ORDER_FIRST+3, sigqueue_start, NULL)
 
 SYSCTL_INT (_kern, OID_AUTO, sugid_coredump, CTLFLAG_RWTUN, &sugid_coredump, 0, "Allow setuid and setgid processes to dump core")
 
 SYSCTL_INT (_kern, OID_AUTO, capmode_coredump, CTLFLAG_RWTUN, &capmode_coredump, 0, "Allow processes in capability mode to dump core")
 
 SYSCTL_INT (_kern, OID_AUTO, coredump, CTLFLAG_RW, &do_coredump, 0, "Enable/Disable coredumps")
 
 SYSCTL_INT (_kern, OID_AUTO, nodump_coredump, CTLFLAG_RW, &set_core_nodump_flag, 0, "Enable setting the NODUMP flag on coredump files")
 
 SYSCTL_INT (_kern, OID_AUTO, coredump_devctl, CTLFLAG_RW, &coredump_devctl, 0, "Generate a devctl notification when processes coredump")
 
ksiginfo_t * ksiginfo_alloc (int wait)
 
void ksiginfo_free (ksiginfo_t *ksi)
 
static __inline int ksiginfo_tryfree (ksiginfo_t *ksi)
 
void sigqueue_init (sigqueue_t *list, struct proc *p)
 
static int sigqueue_get (sigqueue_t *sq, int signo, ksiginfo_t *si)
 
void sigqueue_take (ksiginfo_t *ksi)
 
static int sigqueue_add (sigqueue_t *sq, int signo, ksiginfo_t *si)
 
void sigqueue_flush (sigqueue_t *sq)
 
static void sigqueue_move_set (sigqueue_t *src, sigqueue_t *dst, const sigset_t *set)
 
static void sigqueue_delete_set (sigqueue_t *sq, const sigset_t *set)
 
void sigqueue_delete (sigqueue_t *sq, int signo)
 
static void sigqueue_delete_set_proc (struct proc *p, const sigset_t *set)
 
void sigqueue_delete_proc (struct proc *p, int signo)
 
static void sigqueue_delete_stopmask_proc (struct proc *p)
 
int cursig (struct thread *td)
 
void signotify (struct thread *td)
 
int sigonstack (size_t sp)
 
static bool sigact_flag_test (const struct sigaction *act, int flag)
 
int kern_sigaction (struct thread *td, int sig, const struct sigaction *act, struct sigaction *oact, int flags)
 
int sys_sigaction (struct thread *td, struct sigaction_args *uap)
 
void siginit (struct proc *p)
 
static void sigdflt (struct sigacts *ps, int sig)
 
void execsigs (struct proc *p)
 
int kern_sigprocmask (struct thread *td, int how, sigset_t *set, sigset_t *oset, int flags)
 
int sys_sigprocmask (struct thread *td, struct sigprocmask_args *uap)
 
int sys_sigwait (struct thread *td, struct sigwait_args *uap)
 
int sys_sigtimedwait (struct thread *td, struct sigtimedwait_args *uap)
 
int sys_sigwaitinfo (struct thread *td, struct sigwaitinfo_args *uap)
 
static void proc_td_siginfo_capture (struct thread *td, siginfo_t *si)
 
int kern_sigtimedwait (struct thread *td, sigset_t waitset, ksiginfo_t *ksi, struct timespec *timeout)
 
int sys_sigpending (struct thread *td, struct sigpending_args *uap)
 
int sys_sigsuspend (struct thread *td, struct sigsuspend_args *uap)
 
int kern_sigsuspend (struct thread *td, sigset_t mask)
 
int sys_sigaltstack (struct thread *td, struct sigaltstack_args *uap)
 
int kern_sigaltstack (struct thread *td, stack_t *ss, stack_t *oss)
 
static void killpg1_sendsig (struct proc *p, bool notself, struct killpg1_ctx *arg)
 
int sys_kill (struct thread *td, struct kill_args *uap)
 
int kern_kill (struct thread *td, pid_t pid, int signum)
 
int sys_pdkill (struct thread *td, struct pdkill_args *uap)
 
int sys_sigqueue (struct thread *td, struct sigqueue_args *uap)
 
int kern_sigqueue (struct thread *td, pid_t pid, int signum, union sigval *value)
 
void gsignal (int pgid, int sig, ksiginfo_t *ksi)
 
void pgsignal (struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi)
 
static void postsig_done (int sig, struct thread *td, struct sigacts *ps)
 
void trapsignal (struct thread *td, ksiginfo_t *ksi)
 
void kern_psignal (struct proc *p, int sig)
 
int pksignal (struct proc *p, int sig, ksiginfo_t *ksi)
 
int sigev_findtd (struct proc *p, struct sigevent *sigev, struct thread **ttd)
 
void tdsignal (struct thread *td, int sig)
 
void tdksignal (struct thread *td, int sig, ksiginfo_t *ksi)
 
static int sig_sleepq_abort (struct thread *td, int intrval)
 
int tdsendsignal (struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi)
 
static void ptrace_coredump (struct thread *td)
 
int ptracestop (struct thread *td, int sig, ksiginfo_t *si)
 
void tdsigcleanup (struct thread *td)
 
static int sigdeferstop_curr_flags (int cflags)
 
int sigdeferstop_impl (int mode)
 
void sigallowstop_impl (int prev)
 
static enum sigstatus sigprocess (struct thread *td, int sig)
 
void thread_stopped (struct proc *p)
 
int postsig (int sig)
 
int sig_ast_checksusp (struct thread *td)
 
int sig_ast_needsigchk (struct thread *td)
 
int sig_intr (void)
 
bool curproc_sigkilled (void)
 
void proc_wkilled (struct proc *p)
 
void killproc (struct proc *p, const char *why)
 
void sigexit (struct thread *td, int sig)
 
static void sigparent (struct proc *p, int reason, int status)
 
static void childproc_jobstate (struct proc *p, int reason, int sig)
 
void childproc_stopped (struct proc *p, int reason)
 
void childproc_continued (struct proc *p)
 
void childproc_exited (struct proc *p)
 
 CTASSERT (NUM_CORE_FILES >=0 &&NUM_CORE_FILES<=MAX_NUM_CORE_FILES)
 
static int sysctl_debug_num_cores_check (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_debug_num_cores_check, "I", "Maximum number of generated process corefiles while using index format")
 
static int sysctl_compress_user_cores (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern, OID_AUTO, compress_user_cores, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_NEEDGIANT, 0, sizeof(int), sysctl_compress_user_cores, "I", "Enable compression of user corefiles (" __XSTRING(COMPRESS_GZIP) " = gzip, " __XSTRING(COMPRESS_ZSTD) " = zstd)")
 
 SYSCTL_INT (_kern, OID_AUTO, compress_user_cores_level, CTLFLAG_RWTUN, &compress_user_cores_level, 0, "Corefile compression level")
 
 TUNABLE_STR ("kern.corefile", corefilename, sizeof(corefilename))
 
static int sysctl_kern_corefile (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern, OID_AUTO, corefile, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_corefile, "A", "Process corefile name format string")
 
static void vnode_close_locked (struct thread *td, struct vnode *vp)
 
static int corefile_open_last (struct thread *td, char *name, int indexpos, int indexlen, int ncores, struct vnode **vpp)
 
static int corefile_open (const char *comm, uid_t uid, pid_t pid, struct thread *td, int compress, int signum, struct vnode **vpp, char **namep)
 
int nosys (struct thread *td, struct nosys_args *args)
 
void pgsigio (struct sigio **sigiop, int sig, int checkctty)
 
struct sigacts * sigacts_alloc (void)
 
void sigacts_free (struct sigacts *ps)
 
struct sigacts * sigacts_hold (struct sigacts *ps)
 
void sigacts_copy (struct sigacts *dest, struct sigacts *src)
 
int sigacts_shared (struct sigacts *ps)
 
void sig_drop_caught (struct proc *p)
 
static void sigfastblock_failed (struct thread *td, bool sendsig, bool write)
 
static bool sigfastblock_fetch_sig (struct thread *td, bool sendsig, uint32_t *valp)
 
static void sigfastblock_resched (struct thread *td, bool resched)
 
int sys_sigfastblock (struct thread *td, struct sigfastblock_args *uap)
 
void sigfastblock_clear (struct thread *td)
 
void sigfastblock_fetch (struct thread *td)
 
static void sigfastblock_setpend1 (struct thread *td)
 
void sigfastblock_setpend (struct thread *td, bool resched)
 

Variables

static uma_zone_t ksiginfo_zone = NULL
 
struct filterops sig_filtops
 
static int kern_logsigexit = 1
 
static int kern_forcesigexit = 1
 
static int max_pending_per_proc = 128
 
static int preallocate_siginfo = 1024
 
static int signal_overflow = 0
 
static int signal_alloc_fail = 0
 
static int kern_lognosys = 0
 
__read_frequently bool sigfastblock_fetch_always = false
 
static bool kern_sig_discard_ign = true
 
static int sugid_coredump
 
static int capmode_coredump
 
static int do_coredump = 1
 
static int set_core_nodump_flag = 0
 
static int coredump_devctl = 0
 
static int sigproptbl [NSIG]
 
sigset_t fastblock_mask
 
static int num_cores = NUM_CORE_FILES
 
int compress_user_cores = 0
 
int compress_user_cores_level = 6
 
static char corefilename [MAXPATHLEN] = {"%N.core"}
 

Macro Definition Documentation

◆ _SIG_FOREACH_ADVANCE

#define _SIG_FOREACH_ADVANCE (   i,
  set 
)
Value:
({ \
int __found; \
for (;;) { \
if (__bits != 0) { \
int __sig = ffs(__bits); \
__bits &= ~(1u << (__sig - 1)); \
sig = __i * sizeof((set)->__bits[0]) * NBBY + __sig; \
__found = 1; \
break; \
} \
if (++__i == _SIG_WORDS) { \
__found = 0; \
break; \
} \
__bits = (set)->__bits[__i]; \
} \
__found != 0; \
})
METHOD int set
Definition: cpufreq_if.m:43

Definition at line 252 of file kern_sig.c.

◆ CANSIGIO

#define CANSIGIO (   cr1,
  cr2 
)
Value:
((cr1)->cr_uid == 0 || \
(cr1)->cr_ruid == (cr2)->cr_ruid || \
(cr1)->cr_uid == (cr2)->cr_ruid || \
(cr1)->cr_ruid == (cr2)->cr_uid || \
(cr1)->cr_uid == (cr2)->cr_uid)

Definition at line 179 of file kern_sig.c.

◆ corefilename_lock

#define corefilename_lock   allproc_lock

Definition at line 3603 of file kern_sig.c.

◆ GZIP_SUFFIX

#define GZIP_SUFFIX   ".gz"

Definition at line 3569 of file kern_sig.c.

◆ MAX_NUM_CORE_FILES

#define MAX_NUM_CORE_FILES   100000

Definition at line 3540 of file kern_sig.c.

◆ NUM_CORE_FILES

#define NUM_CORE_FILES   5

Definition at line 3542 of file kern_sig.c.

◆ ONSIG

#define ONSIG   32 /* NSIG for osig* syscalls. XXX. */

Definition at line 96 of file kern_sig.c.

◆ SIG_FOREACH

#define SIG_FOREACH (   i,
  set 
)
Value:
for (int32_t __i = -1, __bits = 0; \
_SIG_FOREACH_ADVANCE(i, set); ) \

Definition at line 271 of file kern_sig.c.

◆ SIGPROP_CONT

#define SIGPROP_CONT   0x20 /* continue if suspended */

Definition at line 216 of file kern_sig.c.

◆ SIGPROP_CORE

#define SIGPROP_CORE   0x02 /* ditto and coredumps */

Definition at line 212 of file kern_sig.c.

◆ SIGPROP_IGNORE

#define SIGPROP_IGNORE   0x10 /* ignore by default */

Definition at line 215 of file kern_sig.c.

◆ SIGPROP_KILL

#define SIGPROP_KILL   0x01 /* terminates process by default */

Definition at line 211 of file kern_sig.c.

◆ SIGPROP_STOP

#define SIGPROP_STOP   0x04 /* suspend process */

Definition at line 213 of file kern_sig.c.

◆ SIGPROP_TTYSTOP

#define SIGPROP_TTYSTOP   0x08 /* ditto, from tty */

Definition at line 214 of file kern_sig.c.

◆ ZSTD_SUFFIX

#define ZSTD_SUFFIX   ".zst"

Definition at line 3570 of file kern_sig.c.

Enumeration Type Documentation

◆ sigstatus

enum sigstatus
Enumerator
SIGSTATUS_HANDLE 
SIGSTATUS_HANDLED 
SIGSTATUS_IGNORE 
SIGSTATUS_SBDRY_STOP 

Definition at line 2908 of file kern_sig.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ childproc_continued()

void childproc_continued ( struct proc *  p)

Definition at line 3513 of file kern_sig.c.

References childproc_jobstate().

Referenced by tdsendsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ childproc_exited()

void childproc_exited ( struct proc *  p)

Definition at line 3519 of file kern_sig.c.

References sigparent().

Referenced by exit1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ childproc_jobstate()

static void childproc_jobstate ( struct proc *  p,
int  reason,
int  sig 
)
static

Definition at line 3480 of file kern_sig.c.

References sigparent(), and wakeup().

Referenced by childproc_continued(), and childproc_stopped().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ childproc_stopped()

void childproc_stopped ( struct proc *  p,
int  reason 
)

Definition at line 3506 of file kern_sig.c.

References childproc_jobstate().

Referenced by thread_stopped().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ coredump()

static int coredump ( struct thread *  td)
static

◆ corefile_open()

static int corefile_open ( const char *  comm,
uid_t  uid,
pid_t  pid,
struct thread *  td,
int  compress,
int  signum,
struct vnode **  vpp,
char **  namep 
)
static

Definition at line 3737 of file kern_sig.c.

References capmode_coredump, corefile_open_last(), corefilename, corefilename_lock, flags, free(), getcredhostname(), GZIP_SUFFIX, log(), malloc(), name, NDFREE(), num_cores, sbuf_delete(), sbuf_error(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), sbuf_putc(), vn_open_cred(), and ZSTD_SUFFIX.

Referenced by coredump().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ corefile_open_last()

static int corefile_open_last ( struct thread *  td,
char *  name,
int  indexpos,
int  indexlen,
int  ncores,
struct vnode **  vpp 
)
static

Definition at line 3640 of file kern_sig.c.

References capmode_coredump, flags, name, NDFREE(), snprintf(), vn_close(), vn_open_cred(), and vnode_close_locked().

Referenced by corefile_open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CTASSERT()

CTASSERT ( NUM_CORE_FILES >=0 &&NUM_CORE_FILES<=  MAX_NUM_CORE_FILES)

◆ curproc_sigkilled()

bool curproc_sigkilled ( void  )

Definition at line 3351 of file kern_sig.c.

References res.

Referenced by core_output().

Here is the caller graph for this function:

◆ cursig()

int cursig ( struct thread *  td)

Definition at line 630 of file kern_sig.c.

References issignal().

Referenced by ast(), kern_sigsuspend(), kern_sigtimedwait(), and sig_ast_needsigchk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execsigs()

void execsigs ( struct proc *  p)

Definition at line 999 of file kern_sig.c.

References sig_drop_caught().

Referenced by do_execve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filt_sigattach()

static int filt_sigattach ( struct knote kn)
static

Definition at line 4079 of file kern_sig.c.

References knlist_add().

Here is the call graph for this function:

◆ filt_sigdetach()

static void filt_sigdetach ( struct knote kn)
static

Definition at line 4092 of file kern_sig.c.

References knlist_remove().

Here is the call graph for this function:

◆ filt_signal()

static int filt_signal ( struct knote kn,
long  hint 
)
static

Definition at line 4106 of file kern_sig.c.

◆ gsignal()

void gsignal ( int  pgid,
int  sig,
ksiginfo_t *  ksi 
)

Definition at line 1955 of file kern_sig.c.

References pgfind(), pgsignal(), and proctree_lock.

Here is the call graph for this function:

◆ issignal()

static int issignal ( struct thread *  td)
static

Definition at line 3098 of file kern_sig.c.

References fastblock_mask, SIG_FOREACH, sigprocess(), sigqueue_delete(), SIGSTATUS_HANDLE, SIGSTATUS_HANDLED, SIGSTATUS_IGNORE, and SIGSTATUS_SBDRY_STOP.

Referenced by cursig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_kill()

int kern_kill ( struct thread *  td,
pid_t  pid,
int  signum 
)

Definition at line 1804 of file kern_sig.c.

References killpg1(), p_cansignal(), pfind_any(), and pksignal().

Referenced by sys_kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_psignal()

void kern_psignal ( struct proc *  p,
int  sig 
)

Definition at line 2117 of file kern_sig.c.

References tdsendsignal().

Referenced by aio_process_rw(), ast(), do_fork(), do_jail_attach(), exit1(), kern_ptrace(), killproc(), lim_cb(), orphanpg(), pgsigio(), prison_deref(), procdesc_close(), realitexpire(), shutdown_nice_task_fn(), soaio_process_job(), sys_pdkill(), tty_signal_sessleader(), and vn_rlimit_fsize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_sigaction()

int kern_sigaction ( struct thread *  td,
int  sig,
const struct sigaction *  act,
struct sigaction *  oact,
int  flags 
)

Definition at line 707 of file kern_sig.c.

References flags, sigact_flag_test(), sigprop(), SIGPROP_IGNORE, and sigqueue_delete_proc().

Referenced by sys_sigaction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_sigaltstack()

int kern_sigaltstack ( struct thread *  td,
stack_t *  ss,
stack_t *  oss 
)

Definition at line 1675 of file kern_sig.c.

References sigonstack().

Referenced by sys_sigaltstack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_sigprocmask()

int kern_sigprocmask ( struct thread *  td,
int  how,
sigset_t *  set,
sigset_t *  oset,
int  flags 
)

Definition at line 1039 of file kern_sig.c.

References flags, reschedule_signals(), set, and signotify().

Referenced by ast(), kern_poll_kfds(), kern_pselect(), kern_sigsuspend(), postsig_done(), sys_setcontext(), sys_sigprocmask(), and sys_swapcontext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_sigqueue()

int kern_sigqueue ( struct thread *  td,
pid_t  pid,
int  signum,
union sigval *  value 
)

Definition at line 1918 of file kern_sig.c.

References p_cansignal(), pfind_any(), pksignal(), and value.

Referenced by sys_sigqueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_sigsuspend()

int kern_sigsuspend ( struct thread *  td,
sigset_t  mask 
)

Definition at line 1539 of file kern_sig.c.

References cursig(), kern_sigprocmask(), mask, postsig(), sigfastblock_fetch(), and thread_suspend_check().

Referenced by sys_sigsuspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_sigtimedwait()

int kern_sigtimedwait ( struct thread *  td,
sigset_t  waitset,
ksiginfo_t *  ksi,
struct timespec *  timeout 
)

Definition at line 1257 of file kern_sig.c.

References cursig(), getnanouptime(), itimer_accept(), kern_sig_discard_ign, proc_td_siginfo_capture(), reschedule_signals(), sigexit(), sigfastblock_fetch(), sigqueue_get(), ts, and tvtohz().

Referenced by sys_sigtimedwait(), sys_sigwait(), and sys_sigwaitinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ killpg1()

static int killpg1 ( struct thread *  td,
int  sig,
int  pgid,
int  all,
ksiginfo_t *  ksi 
)
static

Definition at line 1741 of file kern_sig.c.

References allproc_lock, killpg1_ctx::found, killpg1_sendsig(), killpg1_ctx::ksi, pgfind(), proctree_lock, killpg1_ctx::ret, killpg1_ctx::sent, killpg1_ctx::sig, and killpg1_ctx::td.

Referenced by kern_kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ killpg1_sendsig()

static void killpg1_sendsig ( struct proc *  p,
bool  notself,
struct killpg1_ctx arg 
)
static

Definition at line 1716 of file kern_sig.c.

References killpg1_ctx::found, killpg1_ctx::ksi, p_cansignal(), pksignal(), killpg1_ctx::ret, killpg1_ctx::sent, killpg1_ctx::sig, and killpg1_ctx::td.

Referenced by killpg1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ killproc()

void killproc ( struct proc *  p,
const char *  why 
)

Definition at line 3394 of file kern_sig.c.

References kern_psignal(), log(), and proc_wkilled().

Referenced by lim_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ksiginfo_alloc()

ksiginfo_t * ksiginfo_alloc ( int  wait)

Definition at line 291 of file kern_sig.c.

References flags, and ksiginfo_zone.

Referenced by exit1(), proc_linkup(), and sigqueue_add().

Here is the caller graph for this function:

◆ ksiginfo_free()

void ksiginfo_free ( ksiginfo_t *  ksi)

Definition at line 304 of file kern_sig.c.

References ksiginfo_zone.

Referenced by exit1(), and proc_fini().

Here is the caller graph for this function:

◆ ksiginfo_tryfree()

static __inline int ksiginfo_tryfree ( ksiginfo_t *  ksi)
static

Definition at line 310 of file kern_sig.c.

References ksiginfo_zone.

Referenced by sigqueue_delete_set(), sigqueue_flush(), sigqueue_get(), and tdsendsignal().

Here is the caller graph for this function:

◆ nosys()

int nosys ( struct thread *  td,
struct nosys_args args 
)

Definition at line 4015 of file kern_sig.c.

References kern_lognosys, printf(), tdsignal(), and uprintf().

Referenced by lkmnosys(), and lkmressys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pgsigio()

void pgsigio ( struct sigio **  sigiop,
int  sig,
int  checkctty 
)

Definition at line 4041 of file kern_sig.c.

References CANSIGIO, and kern_psignal().

Referenced by devctl_queue(), kqueue_wakeup(), logtimeout(), pipeselwakeup(), sohasoutofband(), solisten_wakeup(), sowakeup(), and tty_wakeup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pgsignal()

void pgsignal ( struct pgrp *  pgrp,
int  sig,
int  checkctty,
ksiginfo_t *  ksi 
)

Definition at line 1975 of file kern_sig.c.

References pksignal().

Referenced by gsignal(), tty_signal_pgrp(), and tty_wait_background().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pksignal()

int pksignal ( struct proc *  p,
int  sig,
ksiginfo_t *  ksi 
)

Definition at line 2128 of file kern_sig.c.

References tdsendsignal().

Referenced by exit1(), kern_kill(), kern_sigqueue(), killpg1_sendsig(), pgsignal(), proc_reap(), reap_kill_proc(), and sigparent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postsig()

int postsig ( int  sig)

Definition at line 3193 of file kern_sig.c.

References itimer_accept(), postsig_done(), proc_td_siginfo_capture(), sigexit(), and sigqueue_get().

Referenced by ast(), and kern_sigsuspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postsig_done()

static void postsig_done ( int  sig,
struct thread *  td,
struct sigacts *  ps 
)
static

Definition at line 1998 of file kern_sig.c.

References kern_sigprocmask(), mask, and sigdflt().

Referenced by postsig(), and trapsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_td_siginfo_capture()

static void proc_td_siginfo_capture ( struct thread *  td,
siginfo_t *  si 
)
static

Definition at line 1244 of file kern_sig.c.

Referenced by kern_sigtimedwait(), and postsig().

Here is the caller graph for this function:

◆ proc_wkilled()

void proc_wkilled ( struct proc *  p)

Definition at line 3374 of file kern_sig.c.

References proc0, and wakeup().

Referenced by kern_ptrace(), and killproc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ptrace_coredump()

static void ptrace_coredump ( struct thread *  td)
static

Definition at line 2554 of file kern_sig.c.

References wakeup().

Referenced by kern_ptrace(), ptracestop(), and sys_ptrace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ptracestop()

int ptracestop ( struct thread *  td,
int  sig,
ksiginfo_t *  si 
)

Definition at line 2642 of file kern_sig.c.

References ptrace_coredump(), sig_suspend_threads(), sigqueue_add(), sigtd(), tdsendsignal(), and thread_suspend_switch().

Referenced by fork_return(), fork_rfppwait(), kern_thr_exit(), sigprocess(), syscallenter(), and syscallret().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reschedule_signals()

static void reschedule_signals ( struct proc *  p,
sigset_t  block,
int  flags 
)
static

Definition at line 2761 of file kern_sig.c.

References flags, SIG_FOREACH, signotify(), sigtd(), and tdsigwakeup().

Referenced by kern_sigprocmask(), kern_sigtimedwait(), sigfastblock_resched(), sigfastblock_setpend(), and tdsigcleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SDT_PROBE_DEFINE2()

SDT_PROBE_DEFINE2 ( proc  ,
signal__clear  ,
"int"  ,
"ksiginfo_t *"   
)

◆ SDT_PROBE_DEFINE3() [1/2]

SDT_PROBE_DEFINE3 ( proc  ,
signal__discard  ,
"struct thread *"  ,
"struct proc *"  ,
"int"   
)

◆ SDT_PROBE_DEFINE3() [2/2]

SDT_PROBE_DEFINE3 ( proc  ,
signal__send  ,
"struct thread *"  ,
"struct proc *"  ,
"int"   
)

◆ SDT_PROVIDER_DECLARE()

SDT_PROVIDER_DECLARE ( proc  )

◆ sig_ast_checksusp()

int sig_ast_checksusp ( struct thread *  td)

Definition at line 3265 of file kern_sig.c.

References thread_suspend_check().

Referenced by sig_intr(), and sleepq_check_ast_sc_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sig_ast_needsigchk()

int sig_ast_needsigchk ( struct thread *  td)

Definition at line 3282 of file kern_sig.c.

References cursig().

Referenced by sig_intr(), and sleepq_check_ast_sc_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sig_drop_caught()

void sig_drop_caught ( struct proc *  p)

Definition at line 4165 of file kern_sig.c.

References SIG_FOREACH, sigdflt(), sigprop(), SIGPROP_IGNORE, and sigqueue_delete_proc().

Referenced by do_fork(), and execsigs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sig_intr()

int sig_intr ( void  )

Definition at line 3330 of file kern_sig.c.

References sig_ast_checksusp(), and sig_ast_needsigchk().

Referenced by vn_generic_copy_file_range().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sig_sleepq_abort()

static int sig_sleepq_abort ( struct thread *  td,
int  intrval 
)
static

Definition at line 2171 of file kern_sig.c.

References sleepq_abort().

Referenced by tdsendsignal(), and tdsigwakeup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sig_suspend_threads()

static int sig_suspend_threads ( struct thread *  td,
struct proc *  p,
int  sending 
)
static

Definition at line 2590 of file kern_sig.c.

References sleepq_abort(), and thread_suspend_one().

Referenced by ptracestop(), sigprocess(), and tdsendsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigact_flag_test()

static bool sigact_flag_test ( const struct sigaction *  act,
int  flag 
)
static

Definition at line 687 of file kern_sig.c.

References flag.

Referenced by kern_sigaction().

Here is the caller graph for this function:

◆ sigacts_alloc()

struct sigacts * sigacts_alloc ( void  )

Definition at line 4119 of file kern_sig.c.

References malloc().

Referenced by do_execve(), do_fork(), and proc0_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigacts_copy()

void sigacts_copy ( struct sigacts *  dest,
struct sigacts *  src 
)

Definition at line 4148 of file kern_sig.c.

References src.

Referenced by do_execve(), and do_fork().

Here is the caller graph for this function:

◆ sigacts_free()

void sigacts_free ( struct sigacts *  ps)

Definition at line 4130 of file kern_sig.c.

References free().

Referenced by do_execve(), and proc_reap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigacts_hold()

struct sigacts * sigacts_hold ( struct sigacts *  ps)

Definition at line 4140 of file kern_sig.c.

Referenced by do_fork().

Here is the caller graph for this function:

◆ sigacts_shared()

int sigacts_shared ( struct sigacts *  ps)

Definition at line 4158 of file kern_sig.c.

Referenced by do_execve().

Here is the caller graph for this function:

◆ sigallowstop_impl()

void sigallowstop_impl ( int  prev)

Definition at line 2891 of file kern_sig.c.

References sigdeferstop_curr_flags().

Here is the call graph for this function:

◆ sigdeferstop_curr_flags()

static int sigdeferstop_curr_flags ( int  cflags)
static

Definition at line 2831 of file kern_sig.c.

Referenced by sigallowstop_impl(), and sigdeferstop_impl().

Here is the caller graph for this function:

◆ sigdeferstop_impl()

int sigdeferstop_impl ( int  mode)

Definition at line 2849 of file kern_sig.c.

References mode, panic(), and sigdeferstop_curr_flags().

Here is the call graph for this function:

◆ sigdflt()

static void sigdflt ( struct sigacts *  ps,
int  sig 
)
static

Definition at line 984 of file kern_sig.c.

References sigprop(), and SIGPROP_IGNORE.

Referenced by postsig_done(), and sig_drop_caught().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigev_findtd()

int sigev_findtd ( struct proc *  p,
struct sigevent *  sigev,
struct thread **  ttd 
)

Definition at line 2136 of file kern_sig.c.

References tdfind().

Referenced by aio_sendsig(), itimer_fire(), and mqueue_send_notification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigexit()

void sigexit ( struct thread *  td,
int  sig 
)

Definition at line 3416 of file kern_sig.c.

References coredump(), exit1(), kern_logsigexit, log(), sigprop(), SIGPROP_CORE, and thread_single().

Referenced by kern_sigtimedwait(), and postsig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_clear()

void sigfastblock_clear ( struct thread *  td)

Definition at line 4330 of file kern_sig.c.

References sigfastblock_resched().

Referenced by exec_onexec_old(), sigfastblock_failed(), and sys_sigfastblock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_failed()

static void sigfastblock_failed ( struct thread *  td,
bool  sendsig,
bool  write 
)
static

Definition at line 4181 of file kern_sig.c.

References sigfastblock_clear(), and trapsignal().

Referenced by sigfastblock_fetch_sig(), sigfastblock_setpend1(), and sys_sigfastblock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_fetch()

void sigfastblock_fetch ( struct thread *  td)

Definition at line 4344 of file kern_sig.c.

References sigfastblock_fetch_sig().

Referenced by ast(), kern_sigsuspend(), kern_sigtimedwait(), syscallenter(), and trapsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_fetch_sig()

static bool sigfastblock_fetch_sig ( struct thread *  td,
bool  sendsig,
uint32_t *  valp 
)
static

Definition at line 4201 of file kern_sig.c.

References res, sigfastblock_failed(), and valp.

Referenced by sigfastblock_fetch(), and sys_sigfastblock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_resched()

static void sigfastblock_resched ( struct thread *  td,
bool  resched 
)
static

Definition at line 4217 of file kern_sig.c.

References reschedule_signals().

Referenced by sigfastblock_clear(), and sys_sigfastblock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_setpend()

void sigfastblock_setpend ( struct thread *  td,
bool  resched 
)

Definition at line 4383 of file kern_sig.c.

References fastblock_mask, reschedule_signals(), and sigfastblock_setpend1().

Referenced by ast().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigfastblock_setpend1()

static void sigfastblock_setpend1 ( struct thread *  td)
static

Definition at line 4352 of file kern_sig.c.

References res, sigfastblock_failed(), and thread_check_susp().

Referenced by sigfastblock_setpend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ siginit()

void siginit ( struct proc *  p)

Definition at line 963 of file kern_sig.c.

References sigprop(), and SIGPROP_IGNORE.

Referenced by proc0_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signotify()

void signotify ( struct thread *  td)

Definition at line 644 of file kern_sig.c.

Referenced by do_execve(), kern_sigprocmask(), reschedule_signals(), and tdsendsignal().

Here is the caller graph for this function:

◆ sigonstack()

int sigonstack ( size_t  sp)

Definition at line 662 of file kern_sig.c.

Referenced by kern_sigaltstack().

Here is the caller graph for this function:

◆ sigparent()

static void sigparent ( struct proc *  p,
int  reason,
int  status 
)
static

Definition at line 3462 of file kern_sig.c.

References pksignal().

Referenced by childproc_exited(), and childproc_jobstate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigprocess()

static enum sigstatus sigprocess ( struct thread *  td,
int  sig 
)
static

Definition at line 2926 of file kern_sig.c.

References printf(), ptracestop(), sig_suspend_threads(), sigprop(), SIGPROP_IGNORE, SIGPROP_STOP, SIGPROP_TTYSTOP, sigqueue_add(), sigqueue_delete(), sigqueue_get(), SIGSTATUS_HANDLE, SIGSTATUS_HANDLED, SIGSTATUS_IGNORE, SIGSTATUS_SBDRY_STOP, and thread_suspend_switch().

Referenced by issignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigprop()

static __inline int sigprop ( int  sig)
static

Definition at line 678 of file kern_sig.c.

References sigproptbl.

Referenced by kern_sigaction(), sig_drop_caught(), sigdflt(), sigexit(), siginit(), sigprocess(), tdsendsignal(), and tdsigwakeup().

Here is the caller graph for this function:

◆ sigqueue_add()

static int sigqueue_add ( sigqueue_t *  sq,
int  signo,
ksiginfo_t *  si 
)
static

Definition at line 406 of file kern_sig.c.

References ksiginfo_alloc(), ksiginfo_zone, max_pending_per_proc, signal_alloc_fail, and signal_overflow.

Referenced by ptracestop(), sigprocess(), and tdsendsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_delete()

void sigqueue_delete ( sigqueue_t *  sq,
int  signo 
)

Definition at line 574 of file kern_sig.c.

References set, and sigqueue_delete_set().

Referenced by issignal(), kern_ptrace(), sigprocess(), tdsendsignal(), and tdsigwakeup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_delete_proc()

void sigqueue_delete_proc ( struct proc *  p,
int  signo 
)

Definition at line 602 of file kern_sig.c.

References set, and sigqueue_delete_set_proc().

Referenced by exit1(), kern_sigaction(), sig_drop_caught(), and tdsendsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_delete_set()

static void sigqueue_delete_set ( sigqueue_t *  sq,
const sigset_t *  set 
)
static

Definition at line 552 of file kern_sig.c.

References ksiginfo_tryfree(), and set.

Referenced by sigqueue_delete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_delete_set_proc()

static void sigqueue_delete_set_proc ( struct proc *  p,
const sigset_t *  set 
)
static

Definition at line 585 of file kern_sig.c.

References set, sigqueue_flush(), sigqueue_init(), and sigqueue_move_set().

Referenced by sigqueue_delete_proc(), and sigqueue_delete_stopmask_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_delete_stopmask_proc()

static void sigqueue_delete_stopmask_proc ( struct proc *  p)
static

Definition at line 612 of file kern_sig.c.

References set, and sigqueue_delete_set_proc().

Referenced by tdsendsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_flush()

void sigqueue_flush ( sigqueue_t *  sq)

Definition at line 476 of file kern_sig.c.

References ksiginfo_tryfree().

Referenced by exit1(), sigqueue_delete_set_proc(), and tdsigcleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_get()

static int sigqueue_get ( sigqueue_t *  sq,
int  signo,
ksiginfo_t *  si 
)
static

Definition at line 337 of file kern_sig.c.

References count, and ksiginfo_tryfree().

Referenced by kern_sigtimedwait(), postsig(), and sigprocess().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigqueue_init()

void sigqueue_init ( sigqueue_t *  list,
struct proc *  p 
)

Definition at line 320 of file kern_sig.c.

Referenced by proc_linkup(), sigqueue_delete_set_proc(), and thread_link().

Here is the caller graph for this function:

◆ sigqueue_move_set()

static void sigqueue_move_set ( sigqueue_t *  src,
sigqueue_t *  dst,
const sigset_t *  set 
)
static

Definition at line 499 of file kern_sig.c.

References set, and src.

Referenced by sigqueue_delete_set_proc().

Here is the caller graph for this function:

◆ sigqueue_start()

static void sigqueue_start ( void  )
static

Definition at line 278 of file kern_sig.c.

References fastblock_mask, ksiginfo_zone, max_pending_per_proc, p31b_setcfg(), and preallocate_siginfo.

Here is the call graph for this function:

◆ sigqueue_take()

void sigqueue_take ( ksiginfo_t *  ksi)

◆ sigtd()

static struct thread * sigtd ( struct proc *  p,
int  sig,
bool  fast_sigblock 
)
static

Definition at line 2072 of file kern_sig.c.

Referenced by ptracestop(), reschedule_signals(), and tdsendsignal().

Here is the caller graph for this function:

◆ sys_kill()

int sys_kill ( struct thread *  td,
struct kill_args uap 
)

Definition at line 1797 of file kern_sig.c.

References kern_kill(), kill_args::pid, and kill_args::signum.

Here is the call graph for this function:

◆ sys_pdkill()

int sys_pdkill ( struct thread *  td,
struct pdkill_args *  uap 
)

Definition at line 1852 of file kern_sig.c.

References cap_pdkill_rights, kern_psignal(), p_cansignal(), and procdesc_find().

Here is the call graph for this function:

◆ sys_sigaction()

int sys_sigaction ( struct thread *  td,
struct sigaction_args uap 
)

Definition at line 859 of file kern_sig.c.

References sigaction_args::act, kern_sigaction(), sigaction_args::oact, and sigaction_args::sig.

Here is the call graph for this function:

◆ sys_sigaltstack()

int sys_sigaltstack ( struct thread *  td,
struct sigaltstack_args uap 
)

Definition at line 1655 of file kern_sig.c.

References kern_sigaltstack(), sigaltstack_args::oss, and sigaltstack_args::ss.

Here is the call graph for this function:

◆ sys_sigfastblock()

int sys_sigfastblock ( struct thread *  td,
struct sigfastblock_args *  uap 
)

Definition at line 4233 of file kern_sig.c.

References res, sigfastblock_clear(), sigfastblock_failed(), sigfastblock_fetch_sig(), sigfastblock_resched(), and thread_check_susp().

Here is the call graph for this function:

◆ sys_sigpending()

int sys_sigpending ( struct thread *  td,
struct sigpending_args uap 
)

Definition at line 1405 of file kern_sig.c.

References sigpending_args::set.

◆ sys_sigprocmask()

int sys_sigprocmask ( struct thread *  td,
struct sigprocmask_args uap 
)

Definition at line 1113 of file kern_sig.c.

References sigprocmask_args::how, kern_sigprocmask(), sigprocmask_args::oset, set, and sigprocmask_args::set.

Here is the call graph for this function:

◆ sys_sigqueue()

int sys_sigqueue ( struct thread *  td,
struct sigqueue_args uap 
)

Definition at line 1908 of file kern_sig.c.

References kern_sigqueue(), sigqueue_args::pid, sigqueue_args::signum, and sigqueue_args::value.

Here is the call graph for this function:

◆ sys_sigsuspend()

int sys_sigsuspend ( struct thread *  td,
struct sigsuspend_args uap 
)

Definition at line 1527 of file kern_sig.c.

References kern_sigsuspend(), mask, and sigsuspend_args::sigmask.

Here is the call graph for this function:

◆ sys_sigtimedwait()

int sys_sigtimedwait ( struct thread *  td,
struct sigtimedwait_args *  uap 
)

Definition at line 1187 of file kern_sig.c.

References kern_sigtimedwait(), set, and ts.

Here is the call graph for this function:

◆ sys_sigwait()

int sys_sigwait ( struct thread *  td,
struct sigwait_args *  uap 
)

Definition at line 1154 of file kern_sig.c.

References kern_sigtimedwait(), and set.

Here is the call graph for this function:

◆ sys_sigwaitinfo()

int sys_sigwaitinfo ( struct thread *  td,
struct sigwaitinfo_args *  uap 
)

Definition at line 1221 of file kern_sig.c.

References kern_sigtimedwait(), and set.

Here is the call graph for this function:

◆ SYSCTL_BOOL() [1/2]

SYSCTL_BOOL ( _kern  ,
OID_AUTO  ,
sig_discard_ign  ,
CTLFLAG_RWTUN  ,
kern_sig_discard_ign,
,
"Discard ignored signals on  delivery,
otherwise queue them to " "the target queue"   
)

◆ SYSCTL_BOOL() [2/2]

SYSCTL_BOOL ( _kern  ,
OID_AUTO  ,
sigfastblock_fetch_always  ,
CTLFLAG_RWTUN  ,
sigfastblock_fetch_always,
,
"Fetch sigfastblock word on each syscall entry for proper " "blocking semantic"   
)

◆ sysctl_compress_user_cores()

static int sysctl_compress_user_cores ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3575 of file kern_sig.c.

References compress_user_cores, compressor_avail(), and sysctl_handle_int().

Here is the call graph for this function:

◆ sysctl_debug_num_cores_check()

static int sysctl_debug_num_cores_check ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3548 of file kern_sig.c.

References MAX_NUM_CORE_FILES, num_cores, and sysctl_handle_int().

Here is the call graph for this function:

◆ SYSCTL_INT() [1/13]

SYSCTL_INT ( _kern  ,
KERN_LOGSIGEXIT  ,
logsigexit  ,
CTLFLAG_RW  ,
kern_logsigexit,
,
"Log processes quitting on abnormal signals to syslog(3)"   
)

◆ SYSCTL_INT() [2/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
capmode_coredump  ,
CTLFLAG_RWTUN  ,
capmode_coredump,
,
"Allow processes in capability mode to dump core"   
)

◆ SYSCTL_INT() [3/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
compress_user_cores_level  ,
CTLFLAG_RWTUN  ,
compress_user_cores_level,
,
"Corefile compression level  
)

◆ SYSCTL_INT() [4/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
coredump  ,
CTLFLAG_RW  ,
do_coredump,
,
"Enable/Disable coredumps"   
)

◆ SYSCTL_INT() [5/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
coredump_devctl  ,
CTLFLAG_RW  ,
coredump_devctl,
,
"Generate a devctl notification when processes coredump  
)

◆ SYSCTL_INT() [6/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
forcesigexit  ,
CTLFLAG_RW  ,
kern_forcesigexit,
,
"Force trap signal to be handled"   
)

◆ SYSCTL_INT() [7/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
lognosys  ,
CTLFLAG_RWTUN  ,
kern_lognosys,
,
"Log invalid syscalls"   
)

◆ SYSCTL_INT() [8/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
nodump_coredump  ,
CTLFLAG_RW  ,
set_core_nodump_flag,
,
"Enable setting the NODUMP flag on coredump files"   
)

◆ SYSCTL_INT() [9/13]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
sugid_coredump  ,
CTLFLAG_RWTUN  ,
sugid_coredump,
,
"Allow setuid and setgid processes to dump core"   
)

◆ SYSCTL_INT() [10/13]

SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
alloc_fail  ,
CTLFLAG_RD  ,
signal_alloc_fail,
,
"signals failed to be allocated"   
)

◆ SYSCTL_INT() [11/13]

SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
max_pending_per_proc  ,
CTLFLAG_RW  ,
max_pending_per_proc,
,
"Max pending signals per proc"   
)

◆ SYSCTL_INT() [12/13]

SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
overflow  ,
CTLFLAG_RD  ,
signal_overflow,
,
"Number of signals overflew"   
)

◆ SYSCTL_INT() [13/13]

SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
preallocate  ,
CTLFLAG_RDTUN  ,
preallocate_siginfo,
,
"Preallocated signal memory size"   
)

◆ sysctl_kern_corefile()

static int sysctl_kern_corefile ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3609 of file kern_sig.c.

References corefilename, corefilename_lock, and sysctl_handle_string().

Here is the call graph for this function:

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
sigqueue  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"POSIX real time signal"   
)
static

◆ SYSCTL_PROC() [1/3]

SYSCTL_PROC ( _debug  ,
OID_AUTO  ,
ncores  ,
CTLTYPE_INT|CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
sizeof(int)  ,
sysctl_debug_num_cores_check  ,
"I"  ,
"Maximum number of generated process corefiles while using index format"   
)

◆ SYSCTL_PROC() [2/3]

SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
compress_user_cores  ,
CTLTYPE_INT|CTLFLAG_RWTUN|  CTLFLAG_NEEDGIANT,
,
sizeof(int)  ,
sysctl_compress_user_cores  ,
"I"  ,
"Enable compression of user corefiles (" __XSTRING(COMPRESS_GZIP) " = gzip, " __XSTRING(COMPRESS_ZSTD) " = zstd)"   
)

◆ SYSCTL_PROC() [3/3]

SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
corefile  ,
CTLTYPE_STRING|CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
,
sysctl_kern_corefile  ,
"A"  ,
"Process corefile name format string"   
)

◆ SYSINIT()

SYSINIT ( signal  ,
SI_SUB_P1003_1B  ,
SI_ORDER_FIRST+  3,
sigqueue_start  ,
NULL   
)

◆ tdksignal()

void tdksignal ( struct thread *  td,
int  sig,
ksiginfo_t *  ksi 
)

Definition at line 2164 of file kern_sig.c.

References tdsendsignal().

Referenced by sys_thr_kill(), and sys_thr_kill2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tdsendsignal()

◆ tdsigcleanup()

void tdsigcleanup ( struct thread *  td)

Definition at line 2803 of file kern_sig.c.

References reschedule_signals(), and sigqueue_flush().

Referenced by kern_thr_exit(), and kthread_exit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tdsignal()

void tdsignal ( struct thread *  td,
int  sig 
)

Definition at line 2153 of file kern_sig.c.

References tdsendsignal().

Referenced by dofilewrite(), kern_sendit(), nosys(), and soo_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tdsigwakeup()

static void tdsigwakeup ( struct thread *  td,
int  sig,
sig_t  action,
int  intrval 
)
static

Definition at line 2472 of file kern_sig.c.

References sched_prio(), sig_sleepq_abort(), sigprop(), SIGPROP_CONT, SIGPROP_KILL, SIGPROP_STOP, and sigqueue_delete().

Referenced by reschedule_signals(), and tdsendsignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ thread_stopped()

void thread_stopped ( struct proc *  p)

Definition at line 3168 of file kern_sig.c.

References childproc_stopped().

Referenced by kern_thr_exit(), tdsendsignal(), thread_suspend_check(), and thread_suspend_switch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trapsignal()

void trapsignal ( struct thread *  td,
ksiginfo_t *  ksi 
)

Definition at line 2019 of file kern_sig.c.

References fastblock_mask, kern_forcesigexit, postsig_done(), sigfastblock_fetch(), and tdsendsignal().

Referenced by sigfastblock_failed(), and syscallret().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TUNABLE_STR()

TUNABLE_STR ( "kern.corefile"  ,
corefilename  ,
sizeof(corefilename  
)

◆ vnode_close_locked()

static void vnode_close_locked ( struct thread *  td,
struct vnode *  vp 
)
static

Definition at line 3625 of file kern_sig.c.

References vn_close().

Referenced by corefile_open_last().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ capmode_coredump

int capmode_coredump
static

Definition at line 190 of file kern_sig.c.

Referenced by corefile_open(), and corefile_open_last().

◆ compress_user_cores

int compress_user_cores = 0

Definition at line 3572 of file kern_sig.c.

Referenced by coredump(), and sysctl_compress_user_cores().

◆ compress_user_cores_level

int compress_user_cores_level = 6

Definition at line 3595 of file kern_sig.c.

Referenced by coredump().

◆ coredump_devctl

int coredump_devctl = 0
static

Definition at line 202 of file kern_sig.c.

Referenced by coredump().

◆ corefilename

char corefilename[MAXPATHLEN] = {"%N.core"}
static

Definition at line 3605 of file kern_sig.c.

Referenced by corefile_open(), and sysctl_kern_corefile().

◆ do_coredump

int do_coredump = 1
static

Definition at line 194 of file kern_sig.c.

Referenced by coredump().

◆ fastblock_mask

sigset_t fastblock_mask

Definition at line 275 of file kern_sig.c.

Referenced by issignal(), sigfastblock_setpend(), sigqueue_start(), and trapsignal().

◆ kern_forcesigexit

int kern_forcesigexit = 1
static

Definition at line 133 of file kern_sig.c.

Referenced by trapsignal().

◆ kern_lognosys

int kern_lognosys = 0
static

Definition at line 156 of file kern_sig.c.

Referenced by nosys().

◆ kern_logsigexit

int kern_logsigexit = 1
static

Definition at line 128 of file kern_sig.c.

Referenced by sigexit().

◆ kern_sig_discard_ign

bool kern_sig_discard_ign = true
static

Definition at line 166 of file kern_sig.c.

Referenced by kern_sigtimedwait(), and tdsendsignal().

◆ ksiginfo_zone

uma_zone_t ksiginfo_zone = NULL
static

◆ max_pending_per_proc

int max_pending_per_proc = 128
static

Definition at line 140 of file kern_sig.c.

Referenced by sigqueue_add(), and sigqueue_start().

◆ num_cores

int num_cores = NUM_CORE_FILES
static

Definition at line 3545 of file kern_sig.c.

Referenced by corefile_open(), and sysctl_debug_num_cores_check().

◆ preallocate_siginfo

int preallocate_siginfo = 1024
static

Definition at line 144 of file kern_sig.c.

Referenced by sigqueue_start().

◆ set_core_nodump_flag

int set_core_nodump_flag = 0
static

Definition at line 198 of file kern_sig.c.

Referenced by coredump().

◆ sig_filtops

struct filterops sig_filtops
Initial value:
= {
.f_isfd = 0,
.f_attach = filt_sigattach,
.f_detach = filt_sigdetach,
.f_event = filt_signal,
}
static int filt_sigattach(struct knote *kn)
Definition: kern_sig.c:4079
static int filt_signal(struct knote *kn, long hint)
Definition: kern_sig.c:4106
static void filt_sigdetach(struct knote *kn)
Definition: kern_sig.c:4092

Definition at line 121 of file kern_sig.c.

◆ sigfastblock_fetch_always

__read_frequently bool sigfastblock_fetch_always = false

Definition at line 160 of file kern_sig.c.

Referenced by syscallenter().

◆ signal_alloc_fail

int signal_alloc_fail = 0
static

Definition at line 152 of file kern_sig.c.

Referenced by sigqueue_add().

◆ signal_overflow

int signal_overflow = 0
static

Definition at line 148 of file kern_sig.c.

Referenced by sigqueue_add().

◆ sigproptbl

int sigproptbl[NSIG]
static

Definition at line 218 of file kern_sig.c.

Referenced by sigprop().

◆ sugid_coredump

int sugid_coredump
static

Definition at line 186 of file kern_sig.c.

Referenced by coredump().