From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Roland McGrath <roland@redhat.com>,
jan.kratochvil@redhat.com,
Denys Vlasenko <vda.linux@googlemail.com>,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org
Subject: Re: [RFC] Proposal for ptrace improvements
Date: Thu, 3 Mar 2011 18:34:22 +0100 [thread overview]
Message-ID: <20110303173422.GA27960@redhat.com> (raw)
In-Reply-To: <20110301152457.GE26074@htj.dyndns.org>
Hi Tejun,
I didn't read the whole thread yet... perhaps this was already
discussed in more details. IOW, please ignore "I don't understand"
parts, I'll ask the questions later.
On 03/01, Tejun Heo wrote:
>
> I3. Not well-defined job control behaviors while traced
>
> In general, jctl behaviors while ptraced aren't well defined.
I'd say it is not defined at all ;) And to me this is the root of
all problems.
So, many thanks for this RFC. This is the first time someone tries
to define the rules.
> * PTRACE_CONT and other requests which resume the tracee overrides, or
> rather works below, jctl stop. If jctl stop takes place on the task
> group a tracee belongs to, the tracee will eventually participate in
> the group stop and its tracer will be notified; however, when
> PTRACE_CONT or other resuming request is made, the tracee will
> resume execution regardless of and without affecting the jctl stop.
>
> I don't know whether these are by design or just happened as
> by-products of the evolution of task group implementation in the
> kernel, but regardless, in my opinion, both rules are sound and
> useful. They might not be immediately intuitive and the resulting
> behavior might seem quirky but to me it seems to be one of those
> things which looks awkward at first but is ultimately right in its
> usefulness and relative simplicity.
>
> More importantly, it doesn't matter what I or, for that matter, anyone
> else thinks about them. They're tightly ingrained into the
> userland-visible behavior and actively exploited by the current users
> - for example, dynamic evalution in tracee context in gdb(1).
> Changing behaviors as fundamental as these would impact the current
> applications and debugging behaviors expected by (human) users.
OK. I have to agree. Lets forget the PTRACE_CONT-needs-SIGCONT idea.
Nobody like it, including Jan (even if he didn't nack it explicitly).
Forget.
> PROPOSAL
> --------
>
> P1. Always TASK_TRACED while ptraced
OK.
> P2. Fix notifications to the real parent
>
> This pleasantly proved to be the least contentious change to make.
> The usual group stop / continued notifications should be propagated to
> the real parent whether the children are ptraced or not.
Agreed.
> P3. Keep ptrace resume separate from and beneath jctl stop
This is not exactly clear to me... Probably I understand what
you mean, but I am not sure about details.
> P4. PTRACE_SEIZE
This is the new request. You know, I'd like to discuss the details
later and separately. Actually, I think the user-space developers
should participate and tell what they need. As for me, I certainly
agree that SIGSTOP from PTRACE_ATTACH is very wrong, and it is very
bad that gdb has to send SIGSTOP if it wants to stop the tracee.
IOW, I agree that something like this is needed and useful. In
particular,
> In both cases, jctl state is unaffected.
Agreed.
> P5. "^Z" and "fg" for tracees
>
> As proposed, when a tracee enters jctl stop, it enters TASK_TRACED
> from which emission of SIGCONT can't resume the tracee. This makes it
> impossible for a tracer to become transparent with respect to jctl.
> For example, after strace(1) is attached to a task, the task can be
> ^Z'd but then can't be fg'd.
>
> A better way to solve this is simply giving the tracer the capability
> to listen for the end of jctl stop.
Hmm. I don't understand what "the end of jctl stop" actually means.
Since you are talking about WCONTINUED below, I guess it means that
the process is not group-stopped any longer, say, SIGCONT comes.
OK. If the tracer is notified about the end of jctl stop, it can
resume the tracee if it wants. end-of-jctl-stop is per-process, but
I guess the debugger will be notified per-thread. Looks reasonable
to me.
> WCONTINUED is the obvious candidate but I think it is
> better to use STOPPED notification because the task is not really
> resumed. Only its mode of stop changes.
OK.
> What state the tracee is in
> can be determined by retriving siginfo using PTRACE_GETSIGINFO.
I don't understand this this details right now... But I guess this
doesn't matter right now.
Either way, debugger should have the ability to know the tracee's
state wrt group-stop. To oversimplify, it should know the state of
SIGNAL_STOP_STOPPED bit. Correct?
Oleg.
next prev parent reply other threads:[~2011-03-03 17:42 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 15:24 [RFC] Proposal for ptrace improvements Tejun Heo
2011-03-01 16:57 ` Denys Vlasenko
2011-03-01 17:09 ` Tejun Heo
2011-03-01 17:12 ` Tejun Heo
2011-03-01 17:21 ` Denys Vlasenko
2011-03-01 18:34 ` Tejun Heo
2011-03-01 23:51 ` Denys Vlasenko
2011-03-02 7:10 ` Tejun Heo
2011-03-02 5:07 ` Indan Zupancic
2011-03-02 7:44 ` Tejun Heo
2011-03-02 11:32 ` Indan Zupancic
2011-03-02 11:52 ` Denys Vlasenko
2011-03-02 14:50 ` Tejun Heo
2011-03-02 13:32 ` Oleg Nesterov
2011-03-03 0:47 ` Indan Zupancic
2011-03-03 1:30 ` Denys Vlasenko
2011-03-03 1:55 ` Indan Zupancic
2011-03-03 7:03 ` Tejun Heo
2011-03-01 19:06 ` Jan Kratochvil
2011-03-01 22:14 ` Denys Vlasenko
2011-03-02 7:28 ` Tejun Heo
2011-03-02 10:58 ` Denys Vlasenko
2011-03-04 16:14 ` Jan Kratochvil
2011-03-04 16:41 ` Denys Vlasenko
2011-03-04 17:07 ` Oleg Nesterov
2011-03-04 18:12 ` Jan Kratochvil
2011-03-05 8:47 ` Tejun Heo
2011-03-01 22:59 ` Denys Vlasenko
2011-03-02 7:32 ` Tejun Heo
2011-03-02 11:02 ` Denys Vlasenko
2011-03-02 11:23 ` Tejun Heo
2011-03-03 19:26 ` Oleg Nesterov
2011-03-01 23:16 ` Denys Vlasenko
2011-03-02 7:37 ` Tejun Heo
2011-03-02 11:21 ` Denys Vlasenko
2011-03-02 11:27 ` Tejun Heo
2011-03-02 11:48 ` Denys Vlasenko
2011-03-02 14:43 ` Tejun Heo
2011-03-02 15:16 ` Denys Vlasenko
2011-03-02 15:25 ` Tejun Heo
2011-03-03 17:34 ` Oleg Nesterov [this message]
2011-03-03 20:22 ` Oleg Nesterov
2011-03-04 8:23 ` Tejun Heo
2011-03-04 18:16 ` Oleg Nesterov
2011-03-05 8:33 ` Tejun Heo
2011-03-04 13:01 ` Denys Vlasenko
2011-03-04 13:41 ` Tejun Heo
2011-03-04 13:59 ` Denys Vlasenko
2011-03-04 14:07 ` Tejun Heo
2011-03-04 14:31 ` Denys Vlasenko
2011-03-04 14:40 ` Tejun Heo
2011-03-04 17:05 ` Denys Vlasenko
2011-03-04 17:12 ` Linus Torvalds
2011-03-04 18:59 ` Denys Vlasenko
2011-03-04 19:24 ` Linus Torvalds
2011-03-04 16:13 ` Oleg Nesterov
2011-03-04 16:30 ` Oleg Nesterov
2011-03-04 8:44 ` Tejun Heo
2011-03-04 16:01 ` Oleg Nesterov
2011-03-04 16:15 ` Tejun Heo
2011-03-04 16:26 ` Oleg Nesterov
2011-03-07 15:08 ` PTRACE_SEIZE/INTERRUPT: " Oleg Nesterov
2011-03-09 9:41 ` Tejun Heo
2011-03-09 17:30 ` Oleg Nesterov
2011-03-07 20:43 ` Roland McGrath
2011-03-09 10:28 ` Tejun Heo
2011-03-10 18:33 ` Steven Rostedt
2011-03-11 8:13 ` Tejun Heo
2011-03-11 8:22 ` Ingo Molnar
2011-03-11 9:35 ` Srikar Dronamraju
2011-03-11 9:43 ` Ingo Molnar
2011-03-14 1:03 ` Frank Ch. Eigler
2011-03-10 15:55 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110303173422.GA27960@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vda.linux@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).