On 08/18, Roland McGrath wrote:
>
> > In particular, this means that
> >     
> >     if (event || (clone_flags & CLONE_PTRACE)) {
> >             child_engine = utrace_attach_task(child, UTRACE_ATTACH_CREATE 
> > ...
> >
> > is not right. CLONE_PTRACE should be ignored unless task_ptrace(current).
>
> Ok, well this is implicitly assuming that ptrace won't properly detach its
> utrace engine when it should.  In the case of PTRACE_DETACH, the tracee
> (potential parent, here) must be stopped, so it cannot be forking at the
> time.  So you must be worried only about the exit_ptrace() case.

Yes.

> The code triggered from report_clone that adds the new child to the
> tracer's tracees list has to synchronize with exit_ptrace() anyway.  So
> that logic should also cover setup/teardown of the utrace engine.

Yes. That is why I mentioned ptrace_traceme(), it has to avoid the similar
races with the exiting parent.

Oleg.

Reply via email to