Re: [PATCH] Fix for ptrace breakage

OGAWA Hirofumi (hirofumi@mail.parknet.co.jp)
Mon, 16 Sep 2002 20:41:06 +0900


Ingo Molnar <mingo@elte.hu> writes:

> > This patch fixes the following,
> >
> > - race condition of ptrace flag
> > - sent odd signal to the tracer
> > - broken before behavior
>
> (looks good to me). I'm wondering about the following:
>
> - while (!list_empty(&current->children))
> - zap_thread(list_entry(current->children.next,struct task_struct,sibling), current, 0);
> - while (!list_empty(&current->ptrace_children))
> - zap_thread(list_entry(current->ptrace_children.next,struct task_struct,ptrace_list), current, 1);
> + while ((p = eldest_child(current)) != NULL)
> + zap_thread(p, current);
> BUG_ON(!list_empty(&current->children));
>
> is it guaranteed that at this point current->ptrace_children is empty?

Yes, I think so.

list_for_each(_p, &father->ptrace_children) {
p = list_entry(_p,struct task_struct,ptrace_list);
list_del_init(&p->ptrace_list);
reparent_thread(p, reaper, child_reaper);
if (p->parent != p->real_parent)
list_add(&p->ptrace_list, &p->real_parent->ptrace_children);
}

current->ptrace_children should be empty after this reparent.

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/