* [PATCH 1/4] ptrace: kill __ptrace_detach(), fix ->exit_state check
@ 2009-01-29 4:29 Oleg Nesterov
2009-02-05 0:56 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2009-01-29 4:29 UTC (permalink / raw)
To: Andrew Morton
Cc: Jerome Marchand, Roland McGrath, Denys Vlasenko, linux-kernel
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>
--- 6.29-rc3/kernel/ptrace.c~1_KILL_DETACH 2009-01-29 02:30:00.000000000 +0100
+++ 6.29-rc3/kernel/ptrace.c 2009-01-29 03:24:51.000000000 +0100
@@ -235,16 +235,6 @@ out:
return retval;
}
-static inline void __ptrace_detach(struct task_struct *child, unsigned int data)
-{
- child->exit_code = data;
- /* .. re-parent .. */
- __ptrace_unlink(child);
- /* .. and wake it up. */
- if (child->exit_state != EXIT_ZOMBIE)
- wake_up_process(child);
-}
-
int ptrace_detach(struct task_struct *child, unsigned int data)
{
if (!valid_signal(data))
@@ -254,10 +244,16 @@ int ptrace_detach(struct task_struct *ch
ptrace_disable(child);
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- write_lock_irq(&tasklist_lock);
/* protect against de_thread()->release_task() */
- if (child->ptrace)
- __ptrace_detach(child, data);
+ write_lock_irq(&tasklist_lock);
+ if (child->ptrace) {
+ child->exit_code = data;
+
+ __ptrace_unlink(child);
+
+ if (!child->exit_state)
+ wake_up_process(child);
+ }
write_unlock_irq(&tasklist_lock);
return 0;
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/4] ptrace: kill __ptrace_detach(), fix ->exit_state check
2009-01-29 4:29 [PATCH 1/4] ptrace: kill __ptrace_detach(), fix ->exit_state check Oleg Nesterov
@ 2009-02-05 0:56 ` Roland McGrath
0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2009-02-05 0:56 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Jerome Marchand, Denys Vlasenko, linux-kernel
> 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.
Yes, though that is probably impossible anyway. Perhaps in a de_thread
race, but probably harmlessly does nothing. Anyway, certainly fine to
change the test to match all others of the same ilk.
> Actually, I think task_is_stopped_or_traced() makes more sense, but this
> needs another patch.
Agreed. It is one of those nasty cases where the old semantics are
"clearly" wrong, but it's very hard not to worry that some obscure
combination of circumstances means that some common-enough case actually
depends on the "wrong" wakeup.
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Thanks,
Roland
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-05 0:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-29 4:29 [PATCH 1/4] ptrace: kill __ptrace_detach(), fix ->exit_state check Oleg Nesterov
2009-02-05 0:56 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox