Re: [RFC] Proposal for ptrace improvements

From: Tejun Heo
Date: Thu Mar 03 2011 - 02:03:28 EST


Hey, Indan.

On Thu, Mar 03, 2011 at 02:55:32AM +0100, Indan Zupancic wrote:
> > It can be argued that after this the task is running _precisely_
> > because it was continued by the debugger.
>
> That would be an incorrect argument. PTRACE_CONT is supposed to let the
> task continue doing whatever it was doing, and in the case of receiving
> SIGSTOP that was going into a stopped state.

Again, that's your "supposed" which apparently is widely different
depending on who you ask and irrelevant because the currently
implemented visible behavior is completely different.

> Stopped for tracing is not the same as stopped by SIGSTOP! So saying
> to just hang in the traced state is not a good solution. This would
> mean that there are special rules for SIGSTOP handling compared to
> other signals, that's stupid.
>
> - The tracer shouldn't get that second notification at all if it didn't
> ask for it.

You're confused about the two notifications. The first one is signal
delivery notification. The second one is job control stop
notification. They are completely separate.

> - It's hard to distinguish a SIGSTOP from an undocumented "task stopping"
> notification which is lying because the task didn't stop after that
> event was handled.

It is not difficult to distinguish. Use GET_SIGINFO. It has been
like that from the beginning.

> - There is no need or use for this complexity, just pass along SIGSTOP!

No, SIGSTOP delivery and job control stop are two separate steps.

> > The bug is that it can't be continued with SIGCONT after that.
>
> No, that is a side effect of your buggy work around which proves that
> SIGSTOP doesn't currently work.

You're basically trying to restart the previous discussion from the
beginning. Go back and read the thread and read the RFC again.

> For a debugger it doesn't matter much, but for anything that tries to be
> unobtrusive like strace this is just madness.

It actually seems pretty sane to me, but if you think it's a madness,
think of it as wiring in front of sensors. It will help you to accept
it. Why do you think I spent time writing the RFC?

> > Oleg's proposal is a bit different. It proposes that we do need
> > to do PTRACE_CONT after second SIGSTOP notification too,
> > but task will be indeed stopped after this, and resumed
> > when SIGCONT arrives.
>
> Please implement Oleg's proposal, anything else is madness.
>
> Ptrace and task stopping because of SIGSTOP are two independent things
> and should be treated like that, if you want to improve ptrace.

Again, go back, read the thread. Understand it. Read the RFC.
Understand it and come back if you still have something to contribute.
You're pretty short on details but long on claims.

Thanks.

--
tejun
--
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/