diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-06-23 05:05:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:43:03 -0400 |
commit | 260ea1013283d8acbb451459ed1ca560c1445c20 (patch) | |
tree | 35819d28dbfa8600ac0de336147323e660b0390c /include/linux/sched.h | |
parent | 4a4b69f79ba7286794765a856349e380f984a6cb (diff) |
[PATCH] ptrace: document the locking rules
After a lot of reading the code and thinking about how it behaves I have
managed to figure out what the current ptrace locking rules are. The
current code is in much better that it appears at first glance. The
troublesome code paths are actually the code paths that violate the current
rules.
ptrace uses simple exclusive access as it's locking. You can only touch
task->ptrace if the task is stopped and you are the ptracer, or if the task
is running and are the task itself.
Very simple, very easy to maintain. It just needs to be documented so
people know not to touch ptrace from elsewhere.
Currently we do have a few pieces of code that are in violation of this
rule. Particularly the core dump code, and ptrace_attach. But so far the
code looks fixable.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 267f15257040..a9d23c7d1b25 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1225,7 +1225,7 @@ static inline int thread_group_empty(task_t *p) | |||
1225 | (thread_group_leader(p) && !thread_group_empty(p)) | 1225 | (thread_group_leader(p) && !thread_group_empty(p)) |
1226 | 1226 | ||
1227 | /* | 1227 | /* |
1228 | * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring | 1228 | * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring |
1229 | * subscriptions and synchronises with wait4(). Also used in procfs. Also | 1229 | * subscriptions and synchronises with wait4(). Also used in procfs. Also |
1230 | * pins the final release of task.io_context. Also protects ->cpuset. | 1230 | * pins the final release of task.io_context. Also protects ->cpuset. |
1231 | * | 1231 | * |