aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ptrace.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-07-25 22:45:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 15:00:08 -0400
commitdae33574dcf5211e1f43c7e45fa29f73ba3e00cb (patch)
tree090eb4af17451836fb39cebf57fbee64a6bd23b5 /include/linux/ptrace.h
parentdaded34be96b1975ff8539ff62ad8b158ce7d842 (diff)
tracehook: release_task
This moves the ptrace-related logic from release_task into tracehook.h and ptrace.h inlines. It provides clean hooks both before and after locking tasklist_lock, for future tracing logic to do more cleanup without the lock. This also changes release_task() itself in the rare "zap_leader" case to set the leader to EXIT_DEAD before iterating. This maintains the invariant that release_task() only ever handles a task in EXIT_DEAD. This is a common-sense invariant that is already always true except in this one arcane case of zombie leader whose parent ignores SIGCHLD. This change is harmless and only costs one store in this one rare case. It keeps the expected state more consisently sane, which is nicer when debugging weirdness in release_task(). It also lets some future code in the tracehook entry points rely on this invariant for bookkeeping. Signed-off-by: Roland McGrath <roland@redhat.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Reviewed-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/ptrace.h')
-rw-r--r--include/linux/ptrace.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index dae6d85520fb..ed69c03692d9 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -176,6 +176,19 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
176 } 176 }
177} 177}
178 178
179/**
180 * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped
181 * @task: task in %EXIT_DEAD state
182 *
183 * Called with write_lock(&tasklist_lock) held.
184 */
185static inline void ptrace_release_task(struct task_struct *task)
186{
187 BUG_ON(!list_empty(&task->ptraced));
188 ptrace_unlink(task);
189 BUG_ON(!list_empty(&task->ptrace_entry));
190}
191
179#ifndef force_successful_syscall_return 192#ifndef force_successful_syscall_return
180/* 193/*
181 * System call handlers that, upon successful completion, need to return a 194 * System call handlers that, upon successful completion, need to return a