[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081204005203.6B80BFC3BF@magilla.sf.frob.com>
Date: Tue, 2 Dec 2008 18:02:22 -0800 (PST)
From: Roland McGrath <roland@...hat.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: eranian@...glemail.com, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, x86@...nel.org, andi@...stfloor.org,
eranian@...il.com, sfr@...b.auug.org.au,
Oleg Nesterov <oleg@...hat.com>
Subject: Re: [patch 20/24] perfmon: system calls interface
> > + /*
> > + * 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists