Lines Matching refs:t

69 static void __user *sig_handler(struct task_struct *t, int sig)  in sig_handler()  argument
71 return t->sighand->action[sig - 1].sa.sa_handler; in sig_handler()
81 static bool sig_task_ignored(struct task_struct *t, int sig, bool force) in sig_task_ignored() argument
85 handler = sig_handler(t, sig); in sig_task_ignored()
88 if (unlikely(is_global_init(t) && sig_kernel_only(sig))) in sig_task_ignored()
91 if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && in sig_task_ignored()
96 if (unlikely((t->flags & PF_KTHREAD) && in sig_task_ignored()
103 static bool sig_ignored(struct task_struct *t, int sig, bool force) in sig_ignored() argument
110 if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) in sig_ignored()
118 if (t->ptrace && sig != SIGKILL) in sig_ignored()
121 return sig_task_ignored(t, sig, force); in sig_ignored()
156 static bool recalc_sigpending_tsk(struct task_struct *t) in recalc_sigpending_tsk() argument
158 if ((t->jobctl & (JOBCTL_PENDING_MASK | JOBCTL_TRAP_FREEZE)) || in recalc_sigpending_tsk()
159 PENDING(&t->pending, &t->blocked) || in recalc_sigpending_tsk()
160 PENDING(&t->signal->shared_pending, &t->blocked) || in recalc_sigpending_tsk()
161 cgroup_task_frozen(t)) { in recalc_sigpending_tsk()
162 set_tsk_thread_flag(t, TIF_SIGPENDING); in recalc_sigpending_tsk()
178 void recalc_sigpending_and_wake(struct task_struct *t) in recalc_sigpending_and_wake() argument
180 if (recalc_sigpending_tsk(t)) in recalc_sigpending_and_wake()
181 signal_wake_up(t, 0); in recalc_sigpending_and_wake()
414 __sigqueue_alloc(int sig, struct task_struct *t, gfp_t gfp_flags, in __sigqueue_alloc() argument
430 ucounts = task_ucounts(t); in __sigqueue_alloc()
437 if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) { in __sigqueue_alloc()
479 void flush_signals(struct task_struct *t) in flush_signals() argument
483 spin_lock_irqsave(&t->sighand->siglock, flags); in flush_signals()
484 clear_tsk_thread_flag(t, TIF_SIGPENDING); in flush_signals()
485 flush_sigqueue(&t->pending); in flush_signals()
486 flush_sigqueue(&t->signal->shared_pending); in flush_signals()
487 spin_unlock_irqrestore(&t->sighand->siglock, flags); in flush_signals()
527 void ignore_signals(struct task_struct *t) in ignore_signals() argument
532 t->sighand->action[i].sa.sa_handler = SIG_IGN; in ignore_signals()
534 flush_signals(t); in ignore_signals()
542 flush_signal_handlers(struct task_struct *t, int force_default) in flush_signal_handlers() argument
545 struct k_sigaction *ka = &t->sighand->action[0]; in flush_signal_handlers()
770 void signal_wake_up_state(struct task_struct *t, unsigned int state) in signal_wake_up_state() argument
772 lockdep_assert_held(&t->sighand->siglock); in signal_wake_up_state()
774 set_tsk_thread_flag(t, TIF_SIGPENDING); in signal_wake_up_state()
783 if (!wake_up_state(t, state | TASK_INTERRUPTIBLE)) in signal_wake_up_state()
784 kick_process(t); in signal_wake_up_state()
825 static bool kill_ok_by_cred(struct task_struct *t) in kill_ok_by_cred() argument
828 const struct cred *tcred = __task_cred(t); in kill_ok_by_cred()
842 struct task_struct *t) in check_kill_permission() argument
853 error = audit_signal_info(sig, t); /* Let audit system see the signal */ in check_kill_permission()
857 if (!same_thread_group(current, t) && in check_kill_permission()
858 !kill_ok_by_cred(t)) { in check_kill_permission()
861 sid = task_session(t); in check_kill_permission()
874 return security_task_kill(t, info, sig, NULL); in check_kill_permission()
894 static void ptrace_trap_notify(struct task_struct *t) in ptrace_trap_notify() argument
896 WARN_ON_ONCE(!(t->ptrace & PT_SEIZED)); in ptrace_trap_notify()
897 lockdep_assert_held(&t->sighand->siglock); in ptrace_trap_notify()
899 task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY); in ptrace_trap_notify()
900 ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); in ptrace_trap_notify()
916 struct task_struct *t; in prepare_signal() local
932 for_each_thread(p, t) in prepare_signal()
933 flush_sigqueue_mask(&flush, &t->pending); in prepare_signal()
941 for_each_thread(p, t) { in prepare_signal()
942 flush_sigqueue_mask(&flush, &t->pending); in prepare_signal()
943 task_clear_jobctl_pending(t, JOBCTL_STOP_PENDING); in prepare_signal()
944 if (likely(!(t->ptrace & PT_SEIZED))) { in prepare_signal()
945 t->jobctl &= ~JOBCTL_STOPPED; in prepare_signal()
946 wake_up_state(t, __TASK_STOPPED); in prepare_signal()
948 ptrace_trap_notify(t); in prepare_signal()
1008 struct task_struct *t; in complete_signal() local
1016 t = p; in complete_signal()
1027 t = signal->curr_target; in complete_signal()
1028 while (!wants_signal(sig, t)) { in complete_signal()
1029 t = next_thread(t); in complete_signal()
1030 if (t == signal->curr_target) in complete_signal()
1038 signal->curr_target = t; in complete_signal()
1047 !sigismember(&t->real_blocked, sig) && in complete_signal()
1062 t = p; in complete_signal()
1064 task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); in complete_signal()
1065 sigaddset(&t->pending.signal, SIGKILL); in complete_signal()
1066 signal_wake_up(t, 1); in complete_signal()
1067 } while_each_thread(p, t); in complete_signal()
1076 signal_wake_up(t, sig == SIGKILL); in complete_signal()
1086 struct task_struct *t, enum pid_type type, bool force) in __send_signal_locked() argument
1093 lockdep_assert_held(&t->sighand->siglock); in __send_signal_locked()
1096 if (!prepare_signal(sig, t, force)) in __send_signal_locked()
1099 pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending; in __send_signal_locked()
1113 if ((sig == SIGKILL) || (t->flags & PF_KTHREAD)) in __send_signal_locked()
1130 q = __sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit, 0); in __send_signal_locked()
1141 task_active_pid_ns(t)); in __send_signal_locked()
1144 from_kuid_munged(task_cred_xxx(t, user_ns), in __send_signal_locked()
1179 signalfd_notify(t, sig); in __send_signal_locked()
1185 hlist_for_each_entry(delayed, &t->signal->multiprocess, node) { in __send_signal_locked()
1196 complete_signal(sig, t, type); in __send_signal_locked()
1198 trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result); in __send_signal_locked()
1227 struct task_struct *t, enum pid_type type) in send_signal_locked() argument
1234 force = !task_pid_nr_ns(current, task_active_pid_ns(t)); in send_signal_locked()
1243 t_user_ns = task_cred_xxx(t, user_ns); in send_signal_locked()
1254 if (!task_pid_nr_ns(current, task_active_pid_ns(t))) { in send_signal_locked()
1259 return __send_signal_locked(sig, info, t, type, force); in send_signal_locked()
1337 force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t, in force_sig_info_to_task() argument
1345 spin_lock_irqsave(&t->sighand->siglock, flags); in force_sig_info_to_task()
1346 action = &t->sighand->action[sig-1]; in force_sig_info_to_task()
1348 blocked = sigismember(&t->blocked, sig); in force_sig_info_to_task()
1354 sigdelset(&t->blocked, sig); in force_sig_info_to_task()
1355 recalc_sigpending_and_wake(t); in force_sig_info_to_task()
1363 (!t->ptrace || (handler == HANDLER_EXIT))) in force_sig_info_to_task()
1364 t->signal->flags &= ~SIGNAL_UNKILLABLE; in force_sig_info_to_task()
1365 ret = send_signal_locked(sig, info, t, PIDTYPE_PID); in force_sig_info_to_task()
1366 spin_unlock_irqrestore(&t->sighand->siglock, flags); in force_sig_info_to_task()
1381 struct task_struct *t = p; in zap_other_threads() local
1386 while_each_thread(p, t) { in zap_other_threads()
1387 task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); in zap_other_threads()
1389 if ((t->flags & (PF_IO_WORKER | PF_USER_WORKER)) != PF_USER_WORKER) in zap_other_threads()
1393 if (t->exit_state) in zap_other_threads()
1395 sigaddset(&t->pending.signal, SIGKILL); in zap_other_threads()
1396 signal_wake_up(t, 1); in zap_other_threads()
1724 , struct task_struct *t) in force_sig_fault_to_task() argument
1738 return force_sig_info_to_task(&info, t, HANDLER_CURRENT); in force_sig_fault_to_task()
1750 , struct task_struct *t) in send_sig_fault() argument
1764 return send_sig_info(info.si_signo, &info, t); in send_sig_fault()
1781 int send_sig_mceerr(int code, void __user *addr, short lsb, struct task_struct *t) in send_sig_mceerr() argument
1792 return send_sig_info(info.si_signo, &info, t); in send_sig_mceerr()
1909 struct task_struct *t) in send_sig_fault_trapno() argument
1919 return send_sig_info(info.si_signo, &info, t); in send_sig_fault_trapno()
1983 struct task_struct *t; in send_sigqueue() local
2003 t = pid_task(pid, type); in send_sigqueue()
2004 if (!t) in send_sigqueue()
2007 same_thread_group(t, current) && !current->exit_state) in send_sigqueue()
2008 t = current; in send_sigqueue()
2009 if (!likely(lock_task_sighand(t, &flags))) in send_sigqueue()
2014 if (!prepare_signal(sig, t, false)) in send_sigqueue()
2030 signalfd_notify(t, sig); in send_sigqueue()
2031 pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending; in send_sigqueue()
2034 complete_signal(sig, t, type); in send_sigqueue()
2037 trace_signal_generate(sig, &q->info, t, type != PIDTYPE_PID, result); in send_sigqueue()
2038 unlock_task_sighand(t, &flags); in send_sigqueue()
2426 struct task_struct *t; in do_signal_stop() local
2462 t = current; in do_signal_stop()
2463 while_each_thread(current, t) { in do_signal_stop()
2469 if (!task_is_stopped(t) && in do_signal_stop()
2470 task_set_jobctl_pending(t, signr | gstop)) { in do_signal_stop()
2472 if (likely(!(t->ptrace & PT_SEIZED))) in do_signal_stop()
2473 signal_wake_up(t, 0); in do_signal_stop()
2475 ptrace_trap_notify(t); in do_signal_stop()
2961 struct task_struct *t; in retarget_shared_pending() local
2967 t = tsk; in retarget_shared_pending()
2968 while_each_thread(tsk, t) { in retarget_shared_pending()
2969 if (t->flags & PF_EXITING) in retarget_shared_pending()
2972 if (!has_pending_signals(&retarget, &t->blocked)) in retarget_shared_pending()
2975 sigandsets(&retarget, &retarget, &t->blocked); in retarget_shared_pending()
2977 if (!task_sigpending(t)) in retarget_shared_pending()
2978 signal_wake_up(t, 0); in retarget_shared_pending()
3744 struct timespec64 t; in COMPAT_SYSCALL_DEFINE4() local
3755 if (get_timespec64(&t, uts)) in COMPAT_SYSCALL_DEFINE4()
3759 ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); in COMPAT_SYSCALL_DEFINE4()
3775 struct timespec64 t; in COMPAT_SYSCALL_DEFINE4() local
3786 if (get_old_timespec32(&t, uts)) in COMPAT_SYSCALL_DEFINE4()
3790 ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); in COMPAT_SYSCALL_DEFINE4()
4135 struct task_struct *p = current, *t; in do_sigaction() local
4189 for_each_thread(p, t) in do_sigaction()
4190 flush_sigqueue_mask(&mask, &t->pending); in do_sigaction()
4219 struct task_struct *t = current; in do_sigaltstack() local
4224 oss->ss_sp = (void __user *) t->sas_ss_sp; in do_sigaltstack()
4225 oss->ss_size = t->sas_ss_size; in do_sigaltstack()
4248 if (t->sas_ss_sp == (unsigned long)ss_sp && in do_sigaltstack()
4249 t->sas_ss_size == ss_size && in do_sigaltstack()
4250 t->sas_ss_flags == ss_flags) in do_sigaltstack()
4264 t->sas_ss_sp = (unsigned long) ss_sp; in do_sigaltstack()
4265 t->sas_ss_size = ss_size; in do_sigaltstack()
4266 t->sas_ss_flags = ss_flags; in do_sigaltstack()
4300 struct task_struct *t = current; in __save_altstack() local
4301 int err = __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) | in __save_altstack()
4302 __put_user(t->sas_ss_flags, &uss->ss_flags) | in __save_altstack()
4303 __put_user(t->sas_ss_size, &uss->ss_size); in __save_altstack()
4354 struct task_struct *t = current; in __compat_save_altstack() local
4355 err = __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), in __compat_save_altstack()
4357 __put_user(t->sas_ss_flags, &uss->ss_flags) | in __compat_save_altstack()
4358 __put_user(t->sas_ss_size, &uss->ss_size); in __compat_save_altstack()
4839 void kdb_send_sig(struct task_struct *t, int sig) in kdb_send_sig() argument
4843 if (!spin_trylock(&t->sighand->siglock)) { in kdb_send_sig()
4849 new_t = kdb_prev_t != t; in kdb_send_sig()
4850 kdb_prev_t = t; in kdb_send_sig()
4851 if (!task_is_running(t) && new_t) { in kdb_send_sig()
4852 spin_unlock(&t->sighand->siglock); in kdb_send_sig()
4861 ret = send_signal_locked(sig, SEND_SIG_PRIV, t, PIDTYPE_PID); in kdb_send_sig()
4862 spin_unlock(&t->sighand->siglock); in kdb_send_sig()
4865 sig, t->pid); in kdb_send_sig()
4867 kdb_printf("Signal %d is sent to process %d.\n", sig, t->pid); in kdb_send_sig()