All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: penguin-kernel@i-love.sakura.ne.jp
Cc: roland@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: arch_ptrace_attach() without ptrace_traceme()?
Date: Mon, 27 Jun 2011 19:40:41 +0200	[thread overview]
Message-ID: <20110627174041.GA13983@redhat.com> (raw)
In-Reply-To: <20110627133420.GA3527@redhat.com>

On 06/27, Oleg Nesterov wrote:
>
> On 06/27, penguin-kernel@i-love.sakura.ne.jp wrote:
> >
> > Regarding commit f1671f6d "ptrace: fix exit_ptrace() vs ptrace_traceme() race",
> > is calling arch_ptrace_attach() when ptrace_traceme() returned 0 without doing
> > anything (due to PF_EXITING race) expected behavior?
>
> Hmm. Good point, I thinks this should be fixed.

But it is not clear how we can fix this, perhaps we should ignore this
problem...

arch_ptrace_attach() is inherently racy when PTRACE_TRACEME is called.
Please note that f1671f6d did not introduce this race, although I have
to admit I didn't notice this problem when I did this patch.

The race with PF_EXITING you described doesn't differ from another
scenario. PF_EXITING is not set, ptrace_traceme() actually attaches
the caller, but its paren exits and untraces it before it does
arch_ptrace_attach().

If only I knew what arch_ptrace_attach() can do in general ;) But
probably it should be paired with ptrace_disable(), and it is not
called when the tracer detaches on exit anyway. So I think we can
ignore this race.

Oleg.


      reply	other threads:[~2011-06-27 17:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201106270720.p5R7Kd9E095193@www262.sakura.ne.jp>
2011-06-27 13:34 ` arch_ptrace_attach() without ptrace_traceme()? Oleg Nesterov
2011-06-27 17:40   ` Oleg Nesterov [this message]

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=20110627174041.GA13983@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=roland@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.