public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Salman Qazi <sqazi@google.com>
Cc: taviso@google.com, Roland Dreier <rolandd@cisco.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Race in ptrace.
Date: Thu, 11 Feb 2010 21:59:29 +0100	[thread overview]
Message-ID: <20100211205929.GA27038@redhat.com> (raw)
In-Reply-To: <4352991a1002111239m681107f8g9e3802daf7ab706b@mail.gmail.com>

On 02/11, Salman Qazi wrote:
>
> On Thu, Feb 11, 2010 at 12:10 PM, Oleg Nesterov <oleg@redhat.com> wrote:
> >>
> > Why? The tracee reports all signals. If the tracer does
> > ptrace(PTRACE_WHATEVER, SIGXXX) surely it knows SIGXXX is sent to
> > tracee.
>
> The ptrace syscall fails, as the child is running and so we are unable
> to restart the child.  I suppose it is not accurate to say "impossible
> to intercept" if it eventually works.  But, it's an unpleasant
> behaviour.  How do you distinguish between this race and the child
> suddenly becoming untraced or dying?

The child can't become untraced unless the tracer detaches. If the
tracee dies the tracer can notice this via wait(). And please note
again, this particular case is not possible when the tracee is
TASK_TRACED. The tracer explicitly instructed the tracee to stop in
TASK_STOPPED, it should take care of SIGCONT case.

But don't get me wrong, see below,

> > In any case. This is how ptrace currently works, there is no race
> > and the patch is not needed (in fact it is very wrong, but this
> > soesn't matter).
> >
> > Do you agree?
>
> I agree that the patch is wrong because of the reasons you mentioned
> earlier.  But I think there is an issue here.  It's hard to say what
> it is supposed to do, but I can certainly see it being more useful
> this behaviour wasn't there.

Ha. let me repeat, nobody thinks the current ptrace API is nice.


OK. Thanks Salman for your report and discussion.

Oleg.


  parent reply	other threads:[~2010-02-11 21:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08 22:16 Race in ptrace Salman Qazi
     [not found] ` <20100208143231.6d804590.akpm@linux-foundation.org>
2010-02-09 11:27   ` Oleg Nesterov
2010-02-10 13:35     ` Oleg Nesterov
2010-02-10 18:38       ` Salman Qazi
2010-02-11 12:56         ` Oleg Nesterov
2010-02-11 16:32           ` Salman Qazi
2010-02-11 16:50             ` Oleg Nesterov
2010-02-11 18:43               ` Salman Qazi
2010-02-11 18:55                 ` Oleg Nesterov
2010-02-11 19:08                   ` Salman Qazi
2010-02-11 20:10                     ` Oleg Nesterov
2010-02-11 20:39                       ` Salman Qazi
2010-02-11 20:55                         ` Roland McGrath
2010-02-11 21:05                           ` Salman Qazi
2010-02-11 20:59                         ` Oleg Nesterov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-08 22:04 Salman Qazi

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=20100211205929.GA27038@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=rolandd@cisco.com \
    --cc=sqazi@google.com \
    --cc=taviso@google.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