Lines Matching refs:t
72 static void __user *sig_handler(struct task_struct *t, int sig) in sig_handler() argument
74 return t->sighand->action[sig - 1].sa.sa_handler; in sig_handler()
84 static bool sig_task_ignored(struct task_struct *t, int sig, bool force) in sig_task_ignored() argument
88 handler = sig_handler(t, sig); in sig_task_ignored()
91 if (unlikely(is_global_init(t) && sig_kernel_only(sig))) in sig_task_ignored()
94 if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && in sig_task_ignored()
99 if (unlikely((t->flags & PF_KTHREAD) && in sig_task_ignored()
106 static bool sig_ignored(struct task_struct *t, int sig, bool force) in sig_ignored() argument
113 if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) in sig_ignored()
121 if (t->ptrace && sig != SIGKILL) in sig_ignored()
124 return sig_task_ignored(t, sig, force); in sig_ignored()
159 static bool recalc_sigpending_tsk(struct task_struct *t) in recalc_sigpending_tsk() argument
161 if ((t->jobctl & (JOBCTL_PENDING_MASK | JOBCTL_TRAP_FREEZE)) || in recalc_sigpending_tsk()
162 PENDING(&t->pending, &t->blocked) || in recalc_sigpending_tsk()
163 PENDING(&t->signal->shared_pending, &t->blocked) || in recalc_sigpending_tsk()
164 cgroup_task_frozen(t)) { in recalc_sigpending_tsk()
165 set_tsk_thread_flag(t, TIF_SIGPENDING); in recalc_sigpending_tsk()
402 static struct ucounts *sig_get_ucounts(struct task_struct *t, int sig, in sig_get_ucounts() argument
417 ucounts = task_ucounts(t); in sig_get_ucounts()
424 if (unlikely(!override_rlimit && sigpending > task_rlimit(t, RLIMIT_SIGPENDING))) { in sig_get_ucounts()
446 static struct sigqueue *sigqueue_alloc(int sig, struct task_struct *t, gfp_t gfp_flags, in sigqueue_alloc() argument
449 struct ucounts *ucounts = sig_get_ucounts(t, sig, override_rlimit); in sigqueue_alloc()
493 void flush_signals(struct task_struct *t) in flush_signals() argument
497 spin_lock_irqsave(&t->sighand->siglock, flags); in flush_signals()
498 clear_tsk_thread_flag(t, TIF_SIGPENDING); in flush_signals()
499 flush_sigqueue(&t->pending); in flush_signals()
500 flush_sigqueue(&t->signal->shared_pending); in flush_signals()
501 spin_unlock_irqrestore(&t->sighand->siglock, flags); in flush_signals()
505 void ignore_signals(struct task_struct *t) in ignore_signals() argument
510 t->sighand->action[i].sa.sa_handler = SIG_IGN; in ignore_signals()
512 flush_signals(t); in ignore_signals()
520 flush_signal_handlers(struct task_struct *t, int force_default) in flush_signal_handlers() argument
523 struct k_sigaction *ka = &t->sighand->action[0]; in flush_signal_handlers()
721 void signal_wake_up_state(struct task_struct *t, unsigned int state) in signal_wake_up_state() argument
723 lockdep_assert_held(&t->sighand->siglock); in signal_wake_up_state()
725 set_tsk_thread_flag(t, TIF_SIGPENDING); in signal_wake_up_state()
734 if (!wake_up_state(t, state | TASK_INTERRUPTIBLE)) in signal_wake_up_state()
735 kick_process(t); in signal_wake_up_state()
783 static bool kill_ok_by_cred(struct task_struct *t) in kill_ok_by_cred() argument
786 const struct cred *tcred = __task_cred(t); in kill_ok_by_cred()
800 struct task_struct *t) in check_kill_permission() argument
811 error = audit_signal_info(sig, t); /* Let audit system see the signal */ in check_kill_permission()
815 if (!same_thread_group(current, t) && in check_kill_permission()
816 !kill_ok_by_cred(t)) { in check_kill_permission()
819 sid = task_session(t); in check_kill_permission()
832 return security_task_kill(t, info, sig, NULL); in check_kill_permission()
852 static void ptrace_trap_notify(struct task_struct *t) in ptrace_trap_notify() argument
854 WARN_ON_ONCE(!(t->ptrace & PT_SEIZED)); in ptrace_trap_notify()
855 lockdep_assert_held(&t->sighand->siglock); in ptrace_trap_notify()
857 task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY); in ptrace_trap_notify()
858 ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); in ptrace_trap_notify()
874 struct task_struct *t; in prepare_signal() local
890 for_each_thread(p, t) in prepare_signal()
891 flush_sigqueue_mask(p, &flush, &t->pending); in prepare_signal()
899 for_each_thread(p, t) { in prepare_signal()
900 flush_sigqueue_mask(p, &flush, &t->pending); in prepare_signal()
901 task_clear_jobctl_pending(t, JOBCTL_STOP_PENDING); in prepare_signal()
902 if (likely(!(t->ptrace & PT_SEIZED))) { in prepare_signal()
903 t->jobctl &= ~JOBCTL_STOPPED; in prepare_signal()
904 wake_up_state(t, __TASK_STOPPED); in prepare_signal()
906 ptrace_trap_notify(t); in prepare_signal()
966 struct task_struct *t; in complete_signal() local
974 t = p; in complete_signal()
985 t = signal->curr_target; in complete_signal()
986 while (!wants_signal(sig, t)) { in complete_signal()
987 t = next_thread(t); in complete_signal()
988 if (t == signal->curr_target) in complete_signal()
996 signal->curr_target = t; in complete_signal()
1005 !sigismember(&t->real_blocked, sig) && in complete_signal()
1020 __for_each_thread(signal, t) { in complete_signal()
1021 task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); in complete_signal()
1022 sigaddset(&t->pending.signal, SIGKILL); in complete_signal()
1023 signal_wake_up(t, 1); in complete_signal()
1033 signal_wake_up(t, sig == SIGKILL); in complete_signal()
1043 struct task_struct *t, enum pid_type type, bool force) in __send_signal_locked() argument
1050 lockdep_assert_held(&t->sighand->siglock); in __send_signal_locked()
1053 if (!prepare_signal(sig, t, force)) in __send_signal_locked()
1056 pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending; in __send_signal_locked()
1070 if ((sig == SIGKILL) || (t->flags & PF_KTHREAD)) in __send_signal_locked()
1087 q = sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit); in __send_signal_locked()
1098 task_active_pid_ns(t)); in __send_signal_locked()
1101 from_kuid_munged(task_cred_xxx(t, user_ns), in __send_signal_locked()
1136 signalfd_notify(t, sig); in __send_signal_locked()
1142 hlist_for_each_entry(delayed, &t->signal->multiprocess, node) { in __send_signal_locked()
1153 complete_signal(sig, t, type); in __send_signal_locked()
1155 trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result); in __send_signal_locked()
1184 struct task_struct *t, enum pid_type type) in send_signal_locked() argument
1191 force = !task_pid_nr_ns(current, task_active_pid_ns(t)); in send_signal_locked()
1200 t_user_ns = task_cred_xxx(t, user_ns); in send_signal_locked()
1211 if (!task_pid_nr_ns(current, task_active_pid_ns(t))) { in send_signal_locked()
1216 return __send_signal_locked(sig, info, t, type, force); in send_signal_locked()
1294 force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t, in force_sig_info_to_task() argument
1302 spin_lock_irqsave(&t->sighand->siglock, flags); in force_sig_info_to_task()
1303 action = &t->sighand->action[sig-1]; in force_sig_info_to_task()
1305 blocked = sigismember(&t->blocked, sig); in force_sig_info_to_task()
1311 sigdelset(&t->blocked, sig); in force_sig_info_to_task()
1318 (!t->ptrace || (handler == HANDLER_EXIT))) in force_sig_info_to_task()
1319 t->signal->flags &= ~SIGNAL_UNKILLABLE; in force_sig_info_to_task()
1320 ret = send_signal_locked(sig, info, t, PIDTYPE_PID); in force_sig_info_to_task()
1322 if (!task_sigpending(t)) in force_sig_info_to_task()
1323 signal_wake_up(t, 0); in force_sig_info_to_task()
1324 spin_unlock_irqrestore(&t->sighand->siglock, flags); in force_sig_info_to_task()
1339 struct task_struct *t; in zap_other_threads() local
1344 for_other_threads(p, t) { in zap_other_threads()
1345 task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); in zap_other_threads()
1349 if (t->exit_state) in zap_other_threads()
1351 sigaddset(&t->pending.signal, SIGKILL); in zap_other_threads()
1352 signal_wake_up(t, 1); in zap_other_threads()
1690 struct task_struct *t) in force_sig_fault_to_task() argument
1699 return force_sig_info_to_task(&info, t, HANDLER_CURRENT); in force_sig_fault_to_task()
1707 int send_sig_fault(int sig, int code, void __user *addr, struct task_struct *t) in send_sig_fault() argument
1716 return send_sig_info(info.si_signo, &info, t); in send_sig_fault()
1733 int send_sig_mceerr(int code, void __user *addr, short lsb, struct task_struct *t) in send_sig_mceerr() argument
1744 return send_sig_info(info.si_signo, &info, t); in send_sig_mceerr()
1861 struct task_struct *t) in send_sig_fault_trapno() argument
1871 return send_sig_info(info.si_signo, &info, t); in send_sig_fault_trapno()
1943 static void posixtimer_queue_sigqueue(struct sigqueue *q, struct task_struct *t, enum pid_type type) in posixtimer_queue_sigqueue() argument
1948 signalfd_notify(t, sig); in posixtimer_queue_sigqueue()
1949 pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending; in posixtimer_queue_sigqueue()
1952 complete_signal(sig, t, type); in posixtimer_queue_sigqueue()
1968 struct task_struct *t = pid_task(tmr->it_pid, tmr->it_pid_type); in posixtimer_get_target() local
1970 if (t && tmr->it_pid_type != PIDTYPE_PID && in posixtimer_get_target()
1971 same_thread_group(t, current) && !current->exit_state) in posixtimer_get_target()
1972 t = current; in posixtimer_get_target()
1973 return t; in posixtimer_get_target()
1980 struct task_struct *t; in posixtimer_send_sigqueue() local
1986 t = posixtimer_get_target(tmr); in posixtimer_send_sigqueue()
1987 if (!t) in posixtimer_send_sigqueue()
1990 if (!likely(lock_task_sighand(t, &flags))) in posixtimer_send_sigqueue()
2006 if (!prepare_signal(sig, t, false)) { in posixtimer_send_sigqueue()
2043 posixtimer_sig_ignore(t, q); in posixtimer_send_sigqueue()
2080 posixtimer_queue_sigqueue(q, t, tmr->it_pid_type); in posixtimer_send_sigqueue()
2083 trace_signal_generate(sig, &q->info, t, tmr->it_pid_type != PIDTYPE_PID, result); in posixtimer_send_sigqueue()
2084 unlock_task_sighand(t, &flags); in posixtimer_send_sigqueue()
2557 struct task_struct *t; in do_signal_stop() local
2592 for_other_threads(current, t) { in do_signal_stop()
2598 if (!task_is_stopped(t) && in do_signal_stop()
2599 task_set_jobctl_pending(t, signr | gstop)) { in do_signal_stop()
2601 if (likely(!(t->ptrace & PT_SEIZED))) in do_signal_stop()
2602 signal_wake_up(t, 0); in do_signal_stop()
2604 ptrace_trap_notify(t); in do_signal_stop()
3093 struct task_struct *t; in retarget_shared_pending() local
3099 for_other_threads(tsk, t) { in retarget_shared_pending()
3100 if (t->flags & PF_EXITING) in retarget_shared_pending()
3103 if (!has_pending_signals(&retarget, &t->blocked)) in retarget_shared_pending()
3106 sigandsets(&retarget, &retarget, &t->blocked); in retarget_shared_pending()
3108 if (!task_sigpending(t)) in retarget_shared_pending()
3109 signal_wake_up(t, 0); in retarget_shared_pending()
3875 struct timespec64 t; in COMPAT_SYSCALL_DEFINE4() local
3886 if (get_timespec64(&t, uts)) in COMPAT_SYSCALL_DEFINE4()
3890 ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); in COMPAT_SYSCALL_DEFINE4()
3906 struct timespec64 t; in COMPAT_SYSCALL_DEFINE4() local
3917 if (get_old_timespec32(&t, uts)) in COMPAT_SYSCALL_DEFINE4()
3921 ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); in COMPAT_SYSCALL_DEFINE4()
4304 struct task_struct *p = current, *t; in do_sigaction() local
4360 for_each_thread(p, t) in do_sigaction()
4361 flush_sigqueue_mask(p, &mask, &t->pending); in do_sigaction()
4392 struct task_struct *t = current; in do_sigaltstack() local
4397 oss->ss_sp = (void __user *) t->sas_ss_sp; in do_sigaltstack()
4398 oss->ss_size = t->sas_ss_size; in do_sigaltstack()
4421 if (t->sas_ss_sp == (unsigned long)ss_sp && in do_sigaltstack()
4422 t->sas_ss_size == ss_size && in do_sigaltstack()
4423 t->sas_ss_flags == ss_flags) in do_sigaltstack()
4437 t->sas_ss_sp = (unsigned long) ss_sp; in do_sigaltstack()
4438 t->sas_ss_size = ss_size; in do_sigaltstack()
4439 t->sas_ss_flags = ss_flags; in do_sigaltstack()
4473 struct task_struct *t = current; in __save_altstack() local
4474 int err = __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) | in __save_altstack()
4475 __put_user(t->sas_ss_flags, &uss->ss_flags) | in __save_altstack()
4476 __put_user(t->sas_ss_size, &uss->ss_size); in __save_altstack()
4527 struct task_struct *t = current; in __compat_save_altstack() local
4528 err = __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), in __compat_save_altstack()
4530 __put_user(t->sas_ss_flags, &uss->ss_flags) | in __compat_save_altstack()
4531 __put_user(t->sas_ss_size, &uss->ss_size); in __compat_save_altstack()
5022 void kdb_send_sig(struct task_struct *t, int sig) in kdb_send_sig() argument
5026 if (!spin_trylock(&t->sighand->siglock)) { in kdb_send_sig()
5032 new_t = kdb_prev_t != t; in kdb_send_sig()
5033 kdb_prev_t = t; in kdb_send_sig()
5034 if (!task_is_running(t) && new_t) { in kdb_send_sig()
5035 spin_unlock(&t->sighand->siglock); in kdb_send_sig()
5044 ret = send_signal_locked(sig, SEND_SIG_PRIV, t, PIDTYPE_PID); in kdb_send_sig()
5045 spin_unlock(&t->sighand->siglock); in kdb_send_sig()
5048 sig, t->pid); in kdb_send_sig()
5050 kdb_printf("Signal %d is sent to process %d.\n", sig, t->pid); in kdb_send_sig()