aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2009-04-02 19:58:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 22:04:59 -0400
commit95c3eb76dc07fd81289888ffc42948196b34b444 (patch)
treea656316699a090405387d0071bac2a03a7128f57
parent6588c1e3ff01418acafd938db0740e3477dc8cb7 (diff)
ptrace: kill __ptrace_detach(), fix ->exit_state check
Move the code from __ptrace_detach() to its single caller and kill this helper. Also, fix the ->exit_state check, we shouldn't wake up EXIT_DEAD tasks. Actually, I think task_is_stopped_or_traced() makes more sense, but this needs another patch. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Roland McGrath <roland@redhat.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/ptrace.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index c9cf48b21f05..f62a568e84ec 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -235,16 +235,6 @@ out:
235 return retval; 235 return retval;
236} 236}
237 237
238static inline void __ptrace_detach(struct task_struct *child, unsigned int data)
239{
240 child->exit_code = data;
241 /* .. re-parent .. */
242 __ptrace_unlink(child);
243 /* .. and wake it up. */
244 if (child->exit_state != EXIT_ZOMBIE)
245 wake_up_process(child);
246}
247
248int ptrace_detach(struct task_struct *child, unsigned int data) 238int ptrace_detach(struct task_struct *child, unsigned int data)
249{ 239{
250 if (!valid_signal(data)) 240 if (!valid_signal(data))
@@ -254,10 +244,16 @@ int ptrace_detach(struct task_struct *child, unsigned int data)
254 ptrace_disable(child); 244 ptrace_disable(child);
255 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 245 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
256 246
257 write_lock_irq(&tasklist_lock);
258 /* protect against de_thread()->release_task() */ 247 /* protect against de_thread()->release_task() */
259 if (child->ptrace) 248 write_lock_irq(&tasklist_lock);
260 __ptrace_detach(child, data); 249 if (child->ptrace) {
250 child->exit_code = data;
251
252 __ptrace_unlink(child);
253
254 if (!child->exit_state)
255 wake_up_process(child);
256 }
261 write_unlock_irq(&tasklist_lock); 257 write_unlock_irq(&tasklist_lock);
262 258
263 return 0; 259 return 0;