ptrace: fix PTRACE_LISTEN race corrupting task->state