Lines Matching defs:signal

3  *  linux/kernel/signal.c
33 #include <linux/signal.h>
53 #include <trace/events/signal.h>
63 * SLAB caches for signal bits.
92 if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) &&
108 * signal handler may change by the time it is
115 * Tracers may want to know about even ignored signal unless it
129 static inline bool has_pending_signals(sigset_t *signal, sigset_t *blocked)
137 ready |= signal->sig[i] &~ blocked->sig[i];
140 case 4: ready = signal->sig[3] &~ blocked->sig[3];
141 ready |= signal->sig[2] &~ blocked->sig[2];
142 ready |= signal->sig[1] &~ blocked->sig[1];
143 ready |= signal->sig[0] &~ blocked->sig[0];
146 case 2: ready = signal->sig[1] &~ blocked->sig[1];
147 ready |= signal->sig[0] &~ blocked->sig[0];
150 case 1: ready = signal->sig[0] &~ blocked->sig[0];
155 #define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
161 PENDING(&t->signal->shared_pending, &t->blocked) ||
194 /* Given the mask, find the first available signal that should be serviced. */
205 s = pending->signal.sig;
256 pr_info("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
360 struct signal_struct *sig = task->signal;
387 struct signal_struct *sig = current->signal;
395 /* Have the new thread join an on-going signal group stop */
400 * allocate a new signal queue record
416 * NOTE! A pending signal will hold on to the user refcount,
458 sigemptyset(&queue->signal);
476 flush_sigqueue(&t->signal->shared_pending);
484 sigset_t signal, retain;
487 signal = pending->signal;
496 sigdelset(&signal, sig);
502 sigorsets(&pending->signal, &signal, &retain);
512 __flush_itimer_signals(&tsk->signal->shared_pending);
571 * Collect the siginfo appropriate to this signal. Check if
572 * there is another siginfo for the same signal.
582 sigdelset(&list->signal, sig);
598 * a fast-pathed signal or we must have been
621 * Dequeue a signal and return the element to the caller, which is
639 signr = __dequeue_signal(&tsk->signal->shared_pending,
643 * itimer signal ?
646 * itimers in the signal delivery path to prevent DoS
649 * itimers, as the SIGALRM is a legacy signal and only
651 * restart the timer in the signal dequeue path is
656 struct hrtimer *tmr = &tsk->signal->real_timer;
659 tsk->signal->it_real_incr != 0) {
661 tsk->signal->it_real_incr);
674 * Set a marker that we have dequeued a stop signal. Our
676 * stop signal it is about to process is no longer in the
680 * remain set after the signal we return is ignored or
682 * is to alert stop-signal processing code when another
714 * Might a synchronous signal be in the queue?
716 if (!((pending->signal.sig[0] & ~tsk->blocked.sig[0]) & SYNCHRONOUS_MASK))
720 * Return the first synchronous signal in the queue.
733 * Check if there is another siginfo for the same signal.
740 sigdelset(&pending->signal, sync->info.si_signo);
750 * Tell a process that it has a new active signal..
757 * No need to set need_resched since signal event passing
771 * handle its death signal.
788 sigandsets(&m, mask, &s->signal);
792 sigandnsets(&s->signal, &s->signal, mask);
828 * Bad permissions for sending the signal
843 error = audit_signal_info(sig, t); /* Let audit system see the signal */
895 * the signal actions, these happen immediately at signal-generation
898 * signals. The process stop is done as a signal action for SIG_DFL.
900 * Returns true if the signal should be actually delivered, otherwise
905 struct signal_struct *signal = p->signal;
909 if (signal->flags & SIGNAL_GROUP_EXIT) {
910 if (signal->core_state)
913 * The process is in the middle of dying, drop the signal.
918 * This is a stop signal. Remove SIGCONT from all queues.
921 flush_sigqueue_mask(&flush, &signal->shared_pending);
930 flush_sigqueue_mask(&flush, &signal->shared_pending);
950 if (signal->flags & SIGNAL_STOP_STOPPED)
952 else if (signal->group_stop_count)
961 signal_set_stop_flags(signal, why | SIGNAL_STOP_CONTINUED);
962 signal->group_stop_count = 0;
963 signal->group_exit_code = 0;
975 * as soon as they're available, so putting the signal on the shared queue
997 struct signal_struct *signal = p->signal;
1001 * Now find a thread we can wake up to take the signal off the queue.
1017 t = signal->curr_target;
1020 if (t == signal->curr_target)
1024 * the signal in the queue soon.
1028 signal->curr_target = t;
1032 * Found a killable thread. If the signal will be fatal,
1036 (signal->core_state || !(signal->flags & SIGNAL_GROUP_EXIT)) &&
1040 * This signal will be fatal to the whole group.
1047 * thread has the fatal signal pending.
1049 signal->flags = SIGNAL_GROUP_EXIT;
1050 signal->group_exit_code = sig;
1051 signal->group_stop_count = 0;
1052 __for_each_thread(signal, t) {
1054 sigaddset(&t->pending.signal, SIGKILL);
1062 * The signal is already in the shared-pending queue.
1071 return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
1088 pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending;
1091 * exactly one non-rt signal, so that we can get more
1092 * detailed information about the cause of the signal.
1111 * make sure at least one signal gets delivered and don't
1153 * signal was rt and sent by user using something
1162 * send the signal, but the *info bits are lost.
1169 sigaddset(&pending->signal, sig);
1174 hlist_for_each_entry(delayed, &t->signal->multiprocess, node) {
1175 sigset_t *signal = &delayed->signal;
1176 /* Can't queue both a stop and a continue signal */
1178 sigdelsetmask(signal, SIG_KERNEL_STOP_MASK);
1180 sigdelset(signal, SIGCONT);
1181 sigaddset(signal, sig);
1239 /* A kernel generated signal? */
1258 pr_info("%pD: %s: potentially unexpected fatal signal %d.\n",
1262 pr_info("%s: potentially unexpected fatal signal %d.\n",
1315 * Force a signal that the process can't ignore: if necessary
1316 * we unblock the signal and change any SIG_IGN to SIG_DFL.
1318 * Note: If we unblock the signal, we always reset it to SIG_DFL,
1319 * since we do not want to have a signal handler that was blocked
1351 t->signal->flags &= ~SIGNAL_UNKILLABLE;
1353 /* This can happen if the signal was already pending and blocked */
1374 p->signal->group_stop_count = 0;
1385 sigaddset(&t->pending.signal, SIGKILL);
1440 * send signal info to all the members of a thread group or to the
1459 * __kill_pgrp_info() sends a signal to a process group: this is what the tty
1710 * When things go south during signal handling, we
1711 * will force a SIGSEGV. And if the signal that caused
1713 * make sure we don't even try to deliver the signal..
1825 * process if SIGTRAP is blocked, however, delivering the signal
1827 * space if the signal was asynchronous, so it can clearly be
1982 * This function is used by POSIX timers to deliver a timer signal.
1984 * set), the signal must be delivered to the specific thread (queues
2000 ret = 1; /* the signal is ignored */
2019 pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending;
2021 sigaddset(&pending->signal, sig);
2101 info.si_utime = nsec_to_clock_t(utime + tsk->signal->utime);
2102 info.si_stime = nsec_to_clock_t(stime + tsk->signal->stime);
2125 * signal handler, we just set this to tell do_exit that we
2200 info.si_status = tsk->signal->group_exit_code & 0x7f;
2229 * Returns the signal the ptracer requested the code resume
2231 * the stop signal remains unchanged unless clear_code.
2247 * any signal bookkeeping like checking group_stop_count.
2257 * signal comes in. Handle previous ptrace_unlinks and fatal
2364 * any signal-sending on another CPU that wants to examine it.
2437 struct signal_struct *sig = current->signal;
2455 * still in effect and then receive a stop signal and
2466 * an intervening stop signal is required to cause two
2543 * the stop signal; otherwise, %SIGTRAP.
2545 * When !PT_SEIZED, it's used only for group stop trap with stop signal
2554 struct signal_struct *signal = current->signal;
2558 if (!signal->group_stop_count &&
2559 !(signal->flags & SIGNAL_STOP_STOPPED))
2595 * Now we're sure that there is no pending fatal signal and no
2597 * immediately (if there is a non-fatal signal pending), and
2626 * Update the siginfo structure if the signal has
2643 /* If the (new) signal is now blocked, requeue it. */
2678 struct signal_struct *signal = current->signal;
2706 if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
2709 if (signal->flags & SIGNAL_CLD_CONTINUED)
2714 signal->flags &= ~SIGNAL_CLD_MASK;
2742 if ((signal->flags & SIGNAL_GROUP_EXIT) ||
2743 signal->group_exec_task) {
2745 sigdelset(&current->pending.signal, SIGKILL);
2784 * so that the instruction pointer in the signal stack
2821 * Now we are doing the default action for this signal.
2832 * signal here, the signal must have been generated internally
2834 * case, the signal cannot be dropped.
2836 if (unlikely(signal->flags & SIGNAL_UNKILLABLE) &&
2925 * signal_delivered - called after signal delivery to update blocked signals
2926 * @ksig: kernel signal struct
2929 * This function should be called when a signal has successfully been
2931 * is always blocked), and the signal itself is blocked unless %SA_NODEFER
2938 /* A signal was successfully delivered, and the
2939 saved sigmask was stored on the signal frame,
2964 * group-wide signal. Other threads should be notified now to take
2972 sigandsets(&retarget, &tsk->signal->shared_pending.signal, which);
3004 if (thread_group_empty(tsk) || (tsk->signal->flags & SIGNAL_GROUP_EXIT)) {
3080 * to ensure the process can't miss a shared signal we are going to block.
3093 * In case the signal mask hasn't changed, there is nothing we need
3192 * @oset: previous value of signal mask if non-null
3253 sigorsets(set, &current->pending.signal,
3254 &current->signal->shared_pending.signal);
3262 * sys_rt_sigpending - examine a pending signal that has been raised
3619 * @info: if non-null, the signal's siginfo is returned here
3677 * @uinfo: if non-null, the signal's siginfo is returned here
3822 * sys_kill - send a signal to a process
3824 * @sig: signal to be sent
3890 * @sig: signal to send
3891 * @info: signal info
3894 * Send the signal to the thread group or to the individual thread depending
3914 /* Ensure that only a single signal scope determining flag is set. */
3990 * The null signal is a permissions and process existence
3991 * probe. No signal is actually delivered.
3997 * dies after receiving the signal. The window is tiny,
3998 * and the signal is private anyway.
4019 * sys_tgkill - send signal to one specific thread
4022 * @sig: signal to be sent
4038 * sys_tkill - send signal to one specific task
4040 * @sig: signal to be sent
4042 * Send a signal to only one task, even if it's a CLONE_THREAD task.
4067 * sys_rt_sigqueueinfo - send signal information to a signal
4069 * @sig: signal to be sent
4070 * @uinfo: signal info to be sent
4150 flush_sigqueue_mask(&mask, &current->signal->shared_pending);
4206 * "Setting a signal action to SIG_IGN for a signal that is
4207 * pending shall cause the pending signal to be discarded,
4210 * "Setting a signal action to SIG_DFL for a signal that is
4211 * pending and whose default action is to ignore the signal
4212 * (for example, SIGCHLD), shall cause the pending signal to
4218 flush_sigqueue_mask(&mask, &p->signal->shared_pending);
4397 * @uset: where mask of pending signal is returned
4432 * @oset: previous value of signal mask if non-null
4481 * @sig: signal to be sent
4662 SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
4704 * sys_rt_sigsuspend - replace the signal mask for a value with the
4705 * @unewset value until a signal is received
4706 * @unewset: new signal mask value
4865 * signal internals. This function checks if the required locks are
4866 * available before calling the main signal code, to avoid kdb
4883 kdb_printf("Process is not RUNNING, sending a signal from "
4886 "The signal has _not_ been sent.\n"