> First of all, I believe ptrace_check_attach() is buggy. Yup, sure is! As I mentioned before, utrace-ptrace.patch is a source of couple of ideas, but I don't think you should take it as a "first draft" to work on and fix. Just attack implementing ptrace fresh in light of all the ptrace cleanup work you've been doing and other issues we've been talking about.
> For example, utrace_control(UTRACE_STOP)->utrace_do_stop() finds > the child inside utrace_report_jctl() path in TASK_STOPPED state, Where? utrace_report_jctl is called with the siglock held, and resets to TASK_RUNNING before it unlocks. > sets utrace->stopped and returns true. After that utrace_report_jctl() > clears ->stopped and another engine's ->report_jctl does mutex_lock() > and sets ->state == TASK_INTERRUPTIBLE. TASK_STOPPED should never be seen (by someone holding the siglock, like utrace_do_stop does) until after all ->report_jctl hooks have finished. Thanks, Roland