On 08/17, Roland McGrath wrote:
In that case it can share the code with ptrace_traceme().
I'm not sure I quite follow that. Both PTRACE_TRACEME and PTRACE_ATTACH
paths have to interlock with each other. Auto-tracing in report_clone
doesn't have to worry about that at all, because of the
Yes. But we attach to parent-parent, not to parent == current.
Ah yes, I see your point.
In short: ptrace_report_clone() should copy the tracing state from
current to child when needed. And it should never attach if current
is not traced.
Correct.
In particular, this means that
Change ptrace_traceme() to use the new helpers. Kill the now unused
prepare_ptrace_attach/finish_ptrace_attach.
finish_ptrace_attach(ret) logic was wrong. If -parent has PF_EXITING
we must UTRACE_DETACH but ret == 0. Fix this.
Note: we attach the new engine unconditionally, before security