Lines Matching refs:child
68 void __ptrace_link(struct task_struct *child, struct task_struct *new_parent, in __ptrace_link() argument
71 BUG_ON(!list_empty(&child->ptrace_entry)); in __ptrace_link()
72 list_add(&child->ptrace_entry, &new_parent->ptraced); in __ptrace_link()
73 child->parent = new_parent; in __ptrace_link()
74 child->ptracer_cred = get_cred(ptracer_cred); in __ptrace_link()
83 static void ptrace_link(struct task_struct *child, struct task_struct *new_parent) in ptrace_link() argument
85 __ptrace_link(child, new_parent, current_cred()); in ptrace_link()
116 void __ptrace_unlink(struct task_struct *child) in __ptrace_unlink() argument
119 BUG_ON(!child->ptrace); in __ptrace_unlink()
121 clear_task_syscall_work(child, SYSCALL_TRACE); in __ptrace_unlink()
123 clear_task_syscall_work(child, SYSCALL_EMU); in __ptrace_unlink()
126 child->parent = child->real_parent; in __ptrace_unlink()
127 list_del_init(&child->ptrace_entry); in __ptrace_unlink()
128 old_cred = child->ptracer_cred; in __ptrace_unlink()
129 child->ptracer_cred = NULL; in __ptrace_unlink()
132 spin_lock(&child->sighand->siglock); in __ptrace_unlink()
133 child->ptrace = 0; in __ptrace_unlink()
138 task_clear_jobctl_pending(child, JOBCTL_TRAP_MASK); in __ptrace_unlink()
139 task_clear_jobctl_trapping(child); in __ptrace_unlink()
145 if (!(child->flags & PF_EXITING) && in __ptrace_unlink()
146 (child->signal->flags & SIGNAL_STOP_STOPPED || in __ptrace_unlink()
147 child->signal->group_stop_count)) { in __ptrace_unlink()
148 child->jobctl |= JOBCTL_STOP_PENDING; in __ptrace_unlink()
157 if (!(child->jobctl & JOBCTL_STOP_SIGMASK)) in __ptrace_unlink()
158 child->jobctl |= SIGSTOP; in __ptrace_unlink()
167 if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child)) in __ptrace_unlink()
168 ptrace_signal_wake_up(child, true); in __ptrace_unlink()
170 spin_unlock(&child->sighand->siglock); in __ptrace_unlink()
249 static int ptrace_check_attach(struct task_struct *child, bool ignore_state) in ptrace_check_attach() argument
261 if (child->ptrace && child->parent == current) { in ptrace_check_attach()
266 if (ignore_state || ptrace_freeze_traced(child)) in ptrace_check_attach()
272 WARN_ON_ONCE(!wait_task_inactive(child, __TASK_TRACED|TASK_FROZEN))) in ptrace_check_attach()
582 static int ptrace_detach(struct task_struct *child, unsigned int data) in ptrace_detach() argument
588 ptrace_disable(child); in ptrace_detach()
595 WARN_ON(!child->ptrace || child->exit_state); in ptrace_detach()
600 child->exit_code = data; in ptrace_detach()
601 __ptrace_detach(current, child); in ptrace_detach()
604 proc_ptrace_connector(child, PTRACE_DETACH); in ptrace_detach()
678 static int ptrace_setoptions(struct task_struct *child, unsigned long data) in ptrace_setoptions() argument
688 flags = child->ptrace; in ptrace_setoptions()
691 child->ptrace = flags; in ptrace_setoptions()
696 static int ptrace_getsiginfo(struct task_struct *child, kernel_siginfo_t *info) in ptrace_getsiginfo() argument
701 if (lock_task_sighand(child, &flags)) { in ptrace_getsiginfo()
703 if (likely(child->last_siginfo != NULL)) { in ptrace_getsiginfo()
704 copy_siginfo(info, child->last_siginfo); in ptrace_getsiginfo()
707 unlock_task_sighand(child, &flags); in ptrace_getsiginfo()
712 static int ptrace_setsiginfo(struct task_struct *child, const kernel_siginfo_t *info) in ptrace_setsiginfo() argument
717 if (lock_task_sighand(child, &flags)) { in ptrace_setsiginfo()
719 if (likely(child->last_siginfo != NULL)) { in ptrace_setsiginfo()
720 copy_siginfo(child->last_siginfo, info); in ptrace_setsiginfo()
723 unlock_task_sighand(child, &flags); in ptrace_setsiginfo()
728 static int ptrace_peek_siginfo(struct task_struct *child, in ptrace_peek_siginfo() argument
753 pending = &child->signal->shared_pending; in ptrace_peek_siginfo()
755 pending = &child->pending; in ptrace_peek_siginfo()
762 spin_lock_irq(&child->sighand->siglock); in ptrace_peek_siginfo()
770 spin_unlock_irq(&child->sighand->siglock); in ptrace_peek_siginfo()
842 static int ptrace_resume(struct task_struct *child, long request, in ptrace_resume() argument
849 set_task_syscall_work(child, SYSCALL_TRACE); in ptrace_resume()
851 clear_task_syscall_work(child, SYSCALL_TRACE); in ptrace_resume()
855 set_task_syscall_work(child, SYSCALL_EMU); in ptrace_resume()
857 clear_task_syscall_work(child, SYSCALL_EMU); in ptrace_resume()
863 user_enable_block_step(child); in ptrace_resume()
867 user_enable_single_step(child); in ptrace_resume()
869 user_disable_single_step(child); in ptrace_resume()
881 spin_lock_irq(&child->sighand->siglock); in ptrace_resume()
882 child->exit_code = data; in ptrace_resume()
883 child->jobctl &= ~JOBCTL_TRACED; in ptrace_resume()
884 wake_up_state(child, __TASK_TRACED); in ptrace_resume()
885 spin_unlock_irq(&child->sighand->siglock); in ptrace_resume()
937 ptrace_get_syscall_info_entry(struct task_struct *child, struct pt_regs *regs, in ptrace_get_syscall_info_entry() argument
944 info->entry.nr = syscall_get_nr(child, regs); in ptrace_get_syscall_info_entry()
945 syscall_get_arguments(child, regs, args); in ptrace_get_syscall_info_entry()
954 ptrace_get_syscall_info_seccomp(struct task_struct *child, struct pt_regs *regs, in ptrace_get_syscall_info_seccomp() argument
964 ptrace_get_syscall_info_entry(child, regs, info); in ptrace_get_syscall_info_seccomp()
966 info->seccomp.ret_data = child->ptrace_message; in ptrace_get_syscall_info_seccomp()
973 ptrace_get_syscall_info_exit(struct task_struct *child, struct pt_regs *regs, in ptrace_get_syscall_info_exit() argument
977 info->exit.rval = syscall_get_error(child, regs); in ptrace_get_syscall_info_exit()
980 info->exit.rval = syscall_get_return_value(child, regs); in ptrace_get_syscall_info_exit()
987 ptrace_get_syscall_info(struct task_struct *child, unsigned long user_size, in ptrace_get_syscall_info() argument
990 struct pt_regs *regs = task_pt_regs(child); in ptrace_get_syscall_info()
993 .arch = syscall_get_arch(child), in ptrace_get_syscall_info()
1006 switch (child->last_siginfo ? child->last_siginfo->si_code : 0) { in ptrace_get_syscall_info()
1008 switch (child->ptrace_message) { in ptrace_get_syscall_info()
1010 actual_size = ptrace_get_syscall_info_entry(child, regs, in ptrace_get_syscall_info()
1014 actual_size = ptrace_get_syscall_info_exit(child, regs, in ptrace_get_syscall_info()
1020 actual_size = ptrace_get_syscall_info_seccomp(child, regs, in ptrace_get_syscall_info()
1030 int ptrace_request(struct task_struct *child, long request, in ptrace_request() argument
1033 bool seized = child->ptrace & PT_SEIZED; in ptrace_request()
1043 return generic_ptrace_peekdata(child, addr, data); in ptrace_request()
1046 return generic_ptrace_pokedata(child, addr, data); in ptrace_request()
1052 ret = ptrace_setoptions(child, data); in ptrace_request()
1055 ret = put_user(child->ptrace_message, datalp); in ptrace_request()
1059 ret = ptrace_peek_siginfo(child, addr, data); in ptrace_request()
1063 ret = ptrace_getsiginfo(child, &siginfo); in ptrace_request()
1071 ret = ptrace_setsiginfo(child, &siginfo); in ptrace_request()
1082 if (test_tsk_restore_sigmask(child)) in ptrace_request()
1083 mask = &child->saved_sigmask; in ptrace_request()
1085 mask = &child->blocked; in ptrace_request()
1115 spin_lock_irq(&child->sighand->siglock); in ptrace_request()
1116 child->blocked = new_set; in ptrace_request()
1117 spin_unlock_irq(&child->sighand->siglock); in ptrace_request()
1119 clear_tsk_restore_sigmask(child); in ptrace_request()
1136 if (unlikely(!seized || !lock_task_sighand(child, &flags))) in ptrace_request()
1145 if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP))) in ptrace_request()
1146 ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); in ptrace_request()
1148 unlock_task_sighand(child, &flags); in ptrace_request()
1161 if (unlikely(!seized || !lock_task_sighand(child, &flags))) in ptrace_request()
1164 si = child->last_siginfo; in ptrace_request()
1166 child->jobctl |= JOBCTL_LISTENING; in ptrace_request()
1171 if (child->jobctl & JOBCTL_TRAP_NOTIFY) in ptrace_request()
1172 ptrace_signal_wake_up(child, true); in ptrace_request()
1175 unlock_task_sighand(child, &flags); in ptrace_request()
1179 ret = ptrace_detach(child, data); in ptrace_request()
1184 struct mm_struct *mm = get_task_mm(child); in ptrace_request()
1218 return ptrace_resume(child, request, data); in ptrace_request()
1221 send_sig_info(SIGKILL, SEND_SIG_NOINFO, child); in ptrace_request()
1237 ret = ptrace_regset(child, request, addr, &kiov); in ptrace_request()
1244 ret = ptrace_get_syscall_info(child, addr, datavp); in ptrace_request()
1249 ret = seccomp_get_filter(child, addr, datavp); in ptrace_request()
1253 ret = seccomp_get_metadata(child, addr, datavp); in ptrace_request()
1258 ret = ptrace_get_rseq_configuration(child, addr, datavp); in ptrace_request()
1272 struct task_struct *child; in SYSCALL_DEFINE4() local
1280 child = find_get_task_by_vpid(pid); in SYSCALL_DEFINE4()
1281 if (!child) { in SYSCALL_DEFINE4()
1287 ret = ptrace_attach(child, request, addr, data); in SYSCALL_DEFINE4()
1291 ret = ptrace_check_attach(child, request == PTRACE_KILL || in SYSCALL_DEFINE4()
1296 ret = arch_ptrace(child, request, addr, data); in SYSCALL_DEFINE4()
1298 ptrace_unfreeze_traced(child); in SYSCALL_DEFINE4()
1301 put_task_struct(child); in SYSCALL_DEFINE4()
1330 int compat_ptrace_request(struct task_struct *child, compat_long_t request, in compat_ptrace_request() argument
1341 ret = ptrace_access_vm(child, addr, &word, sizeof(word), in compat_ptrace_request()
1351 ret = ptrace_access_vm(child, addr, &data, sizeof(data), in compat_ptrace_request()
1357 ret = put_user((compat_ulong_t) child->ptrace_message, datap); in compat_ptrace_request()
1361 ret = ptrace_getsiginfo(child, &siginfo); in compat_ptrace_request()
1372 ret = ptrace_setsiginfo(child, &siginfo); in compat_ptrace_request()
1394 ret = ptrace_regset(child, request, addr, &kiov); in compat_ptrace_request()
1402 ret = ptrace_request(child, request, addr, data); in compat_ptrace_request()
1411 struct task_struct *child; in COMPAT_SYSCALL_DEFINE4() local
1419 child = find_get_task_by_vpid(pid); in COMPAT_SYSCALL_DEFINE4()
1420 if (!child) { in COMPAT_SYSCALL_DEFINE4()
1426 ret = ptrace_attach(child, request, addr, data); in COMPAT_SYSCALL_DEFINE4()
1430 ret = ptrace_check_attach(child, request == PTRACE_KILL || in COMPAT_SYSCALL_DEFINE4()
1433 ret = compat_arch_ptrace(child, request, addr, data); in COMPAT_SYSCALL_DEFINE4()
1435 ptrace_unfreeze_traced(child); in COMPAT_SYSCALL_DEFINE4()
1439 put_task_struct(child); in COMPAT_SYSCALL_DEFINE4()