diff options
author | Oleg Nesterov <oleg@redhat.com> | 2011-07-08 19:13:39 +0200 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2011-07-17 20:23:51 +0200 |
commit | 6634ae1033ceaeca5877dd75723210f8c2648c17 (patch) | |
tree | 2ddf9200593934ac0776bb1d3e3646f448dc38fe /include/linux/ptrace.h | |
parent | 961c4675c75112717705fa5c0c53cb9664051479 (diff) | |
download | linux-6634ae1033ceaeca5877dd75723210f8c2648c17.tar.gz linux-6634ae1033ceaeca5877dd75723210f8c2648c17.tar.bz2 linux-6634ae1033ceaeca5877dd75723210f8c2648c17.zip |
ptrace_init_task: initialize child->jobctl explicitly
new_child->jobctl is not initialized during the fork, it is copied
from parent->jobctl. Currently this is harmless, the forking task
is running and copy_process() can't succeed if signal_pending() is
true, so only JOBCTL_STOP_DEQUEUED can be copied. Still this is a
bit fragile, it would be more clean to set ->jobctl = 0 explicitly.
Also, check ->ptrace != 0 instead of PT_PTRACED, move the
CONFIG_HAVE_HW_BREAKPOINT code up.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/ptrace.h')
-rw-r--r-- | include/linux/ptrace.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index eae381d584f9..fd8669fc339f 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -217,16 +217,17 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace) { INIT_LIST_HEAD(&child->ptrace_entry); INIT_LIST_HEAD(&child->ptraced); - child->parent = child->real_parent; +#ifdef CONFIG_HAVE_HW_BREAKPOINT + atomic_set(&child->ptrace_bp_refcnt, 1); +#endif + child->jobctl = 0; child->ptrace = 0; - if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) { + child->parent = child->real_parent; + + if (unlikely(ptrace) && current->ptrace) { child->ptrace = current->ptrace; __ptrace_link(child, current->parent); } - -#ifdef CONFIG_HAVE_HW_BREAKPOINT - atomic_set(&child->ptrace_bp_refcnt, 1); -#endif } /** |