Re: wait_task_zombie() EXIT_DEAD problems

2009-04-20 Thread Roland McGrath
Two threads T1 and T2, and some process X (not the child of T1/T2). T1 ptraces X. X exits and becomes zombie. T2 calls do_wait(WEXITED) and then wait_task_zombie(), it sets EXIT_DEAD and drops tasklist. T1 exits, calls exit_ptrace(). __ptrace_detach() does __ptrace_unlink() and

Re: ptrace cleanup tasks

2009-04-20 Thread Roland McGrath
Then the short-circuit test is simply if (!tsk-ptrace_info). But, from the correctness pov, this doesn't differ from checking !list_empty(-ptraced) ? I mean, the condition can be changed under us in both cases, and we seem to have the same corner cases. I guess it just seems simpler to me.

Re: wait_task_zombie() EXIT_DEAD problems

2009-04-20 Thread Oleg Nesterov
On 04/19, Roland McGrath wrote: X-real_parent calls do_wait() and gets -ECHLD, because X is EXIT_DEAD and not traced. I see. I don't think we should worry especially about fixing this existing bug (ancient, as you call it) on its own. So let's only consider this in the context of the

Re: ptracee data structures cleanup

2009-04-20 Thread Oleg Nesterov
On 04/16, Roland McGrath wrote: But even that is a lot of hair for the incremental patches in the first several stages, I think. So just never deallocate it, and: static inline int task_ptrace(struct task_struct *task) { return unlikely(task-ptrace_child) ?

Re: wait_task_zombie() EXIT_DEAD problems

2009-04-20 Thread Roland McGrath
But, I still think we should do this fix before introducing -ptrace_mutex. Ok by me if it's in fact (incrementally) simpler that way. OK, we should avoid taking tasklist for writing. Then we should check ptrace_reparented() first. If it is true get_task_struct, drop taslist, take it for