ptrace: fix race between ptrace_resume() and wait_task_stopped()