Re: [patch 20/24] perfmon: system calls interface
From: Roland McGrath
Date: Wed Dec 03 2008 - 19:55:35 EST
> > + /*
> > + * cannot attach to a kernel thread
> > + */
> > + if (!task->mm) {
This should test (task->flags & PF_KTHREAD). (But it's superfluous anyway.)
> > + /*
> > + * cannot attach to a zombie task
> > + */
> > + if (task->exit_state == EXIT_ZOMBIE || task->exit_state == EXIT_DEAD) {
The usual test to write here is just "if (task->exit_state)".
(But it's superfluous anyway.)
> Thirdly, the check for ->exit_state in pfm_task_incompatible() is not
> needed: we've just passed ptrace_check_attach() so we know we just
> transitioned the task to task->state == TASK_TRACED.
Correct.
> If you _ever_ see a task exit TASK_TRACED and go zombie or dead from
> there without this code allowing it that means the whole state machine
> with ptrace is borked up by perfmon.
Is always possible for a TASK_TRACED task to suddenly die via SIGKILL, and
it's even possible it will be reaped (EXIT_DEAD) despite ptrace, in the
de_thread() (MT exec) case. This race is tolerable for everything ptrace
does (it holds a task ref, and the arch code copes). It must also be
tolerated by the perfmon code.
> For example i dont see where the perfmon-control task parents itself as
> the exclusive debugger (parent) of the debuggee-task.
ptrace_check_attach() ensures that this is so.
Thanks,
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/