diff options
| author | Roland McGrath <roland@redhat.com> | 2004-09-07 17:48:58 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-07 17:48:58 -0700 |
| commit | cece79ae3a396b6c311a20380904be376c1d9273 (patch) | |
| tree | 23c2879a60f4e3e7fbc5de48658ab36fe3e6baf1 /kernel/power/process.c | |
| parent | cfec5c01d3d2957f346e4560a4eee0a54195b6f6 (diff) | |
[PATCH] cleanup ptrace stops and remove notify_parent
This adds a new state TASK_TRACED that is used in place of TASK_STOPPED
when a thread stops because it is ptraced. Now ptrace operations are only
permitted when the target is in TASK_TRACED state, not in TASK_STOPPED.
This means that if a process is stopped normally by a job control signal
and then you PTRACE_ATTACH to it, you will have to send it a SIGCONT before
you can do any ptrace operations on it. (The SIGCONT will be reported to
ptrace and then you can discard it instead of passing it through when you
call PTRACE_CONT et al.)
If a traced child gets orphaned while in TASK_TRACED state, it morphs into
TASK_STOPPED state. This makes it again possible to resume or destroy the
process with SIGCONT or SIGKILL.
All non-signal tracing stops should now be done via ptrace_notify. I've
updated the syscall tracing code in several architectures to do this
instead of replicating the work by hand. I also fixed several that were
unnecessarily repeating some of the checks in ptrace_check_attach. Calling
ptrace_check_attach alone is sufficient, and the old checks repeated before
are now incorrect, not just superfluous.
I've closed a race in ptrace_check_attach. With this, we should have a
robust guarantee that when ptrace starts operating, the task will be in
TASK_TRACED state and won't come out of it. This is because the only way
to resume from TASK_TRACED is via ptrace operations, and only the one
parent thread attached as the tracer can do those.
This patch also cleans up the do_notify_parent and do_notify_parent_cldstop
code so that the dead and stopped cases are completely disjoint. The
notify_parent function is gone.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/process.c')
| -rw-r--r-- | kernel/power/process.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 0d1f63ec7287..bda013de59a5 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -25,7 +25,8 @@ static inline int freezeable(struct task_struct * p) (p->flags & PF_NOFREEZE) || (p->state == TASK_ZOMBIE) || (p->state == TASK_DEAD) || - (p->state == TASK_STOPPED)) + (p->state == TASK_STOPPED) || + (p->state == TASK_TRACED)) return 0; return 1; } @@ -70,6 +71,7 @@ int freeze_processes(void) if (!freezeable(p)) continue; if ((p->flags & PF_FROZEN) || + (p->state == TASK_TRACED) || (p->state == TASK_STOPPED)) continue; |
