mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Indan Zupancic" <indan@nul.nu>
To: "Denys Vlasenko" <vda.linux@googlemail.com>
Cc: "Oleg Nesterov" <oleg@redhat.com>, "Tejun Heo" <tj@kernel.org>,
	"Roland McGrath" <roland@redhat.com>,
	jan.kratochvil@redhat.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	"Michael Kerrisk" <mtk.manpages@googlemail.com>
Subject: Re: [RFC] Proposal for ptrace improvements
Date: Thu, 3 Mar 2011 02:55:32 +0100 (CET)	[thread overview]
Message-ID: <019ad511a576046f79364a846041a64c.squirrel@webmail.greenhost.nl> (raw)
In-Reply-To: <201103030230.27363.vda.linux@googlemail.com>

On Thu, March 3, 2011 02:30, Denys Vlasenko wrote:
> On Thursday 03 March 2011 01:47, Indan Zupancic wrote:
>> On Wed, March 2, 2011 14:32, Oleg Nesterov wrote:
>> > On 03/02, Tejun Heo wrote:
>> >> On Wed, Mar 02, 2011 at 06:07:35AM +0100, Indan Zupancic wrote:
>> >> > I'm not sure what Denys is talking about: Currently it's impossible to
>> >> > pass along SIGSTOP to traced processes. Quoting the ptrace manpage:
>> >> >
>> >> >    PTRACE_CONT
>> >> >           Restarts  the stopped child process.  If data is nonzero and not
>> >> >           SIGSTOP, it is interpreted as a signal to be  delivered  to  the
>> >> >           child;  otherwise,  no  signal is delivered.
>> >>
>> >> AFAICS, that's not true.  SIGSTOP isn't treated differently from other
>> >> signals in the ptrace signal delivery path.  Maybe it was true in the
>> >> past.
>> >
>> > Yes, this is not true. And it seems this was never true.
>> >
>> > This is the second time this manpage confuses people in this discussion,
>> > probably it should be fixed...
>>
>> Passing SIGSTOP does not actually stop the traced task, which is in line
>> with what the manpage says. All it does is generating that second SIGSTOP
>> notification, but when the task is continued it's running, not stopped.
>
> 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.

>> So ptraced tasks can't be stopped with SIGSTOP and continued with SIGCONT.
>
> It can be stopped - just do not PTRACE_CONT it after second SIGSTOP
> notification.

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.

- 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.

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

>
> 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.

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

> That's the gist of Tejun Heo's proposal.
>
> 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.

Greetings,

Indan



  reply	other threads:[~2011-03-03  1:55 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 15:24 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 [this message]
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
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=019ad511a576046f79364a846041a64c.squirrel@webmail.greenhost.nl \
    --to=indan@nul.nu \
    --cc=akpm@linux-foundation.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=oleg@redhat.com \
    --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

all inboxes | Powered by JetHome®