> 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 writing, untrace, etc. Sounds right. > Then re-take tasklist for reading and continue the reaping. You don't need tasklist_lock again, assuming you did do_notify_parent() while holding it for write (as done now). You are just resuming the normal tail of wait_task_zombie() after it's dropped tasklist_lock. If we are not going to call release_task() (i.e. after untrace + do_notify_parent() it does not then want auto-reap), we just keep the task ref through the getrusage/put_user and do put_task_struct() at the end. > And of course, we should re-check the task every time we take tasklist > and return E_GOTO_REPEAT if it was untraced or released. Right. > On top of this changes, it would be easier to change the locking. Ok. > Hmm... looking at the current code in wait_task_zombie() under > "if (traced)", shouldn't we check !same_thread_group(p->real_parent, current) > before do_notify_parent() ? It's impossible. ptrace_attach() doesn't allow it. Thanks, Roland