All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Denys Vlasenko <vda.linux@googlemail.com>,
	linux-kernel@vger.kernel.org, dvlasenk@redhat.com
Subject: Re: [PATCH v2] Make PTRACE_SEIZE set ptrace options specified in 'data' parameter
Date: Sun, 11 Sep 2011 11:05:23 +0900	[thread overview]
Message-ID: <20110911020523.GL29319@htj.dyndns.org> (raw)
In-Reply-To: <20110908181747.GA28120@redhat.com>

Hello,

On Thu, Sep 08, 2011 at 08:17:47PM +0200, Oleg Nesterov wrote:
> > There are places which assume ->ptrace is protected by siglock.
> 
> Really? Once again, I agree. But _afaics_ currently this is not strictly
> needed. PT_PTRACED/PT_SEIZED should not go away under ->siglock, yes, but
> it seems that it is fine to set them.

Hmmm.... I haven't checked each direction.  Maybe we don't strictly
need it on setting it but I definitely was assuming that ->ptrace was
protected by siglock while coding recent ptrace changes.  Can't the
following happen?

* ptracer seizes child, sets PT_PTRACED and then OR PT_SEIZED.

* ptracee enters signal delivery path with group stop scheduled.
  PT_PTRACED is visible and group stop is transformed into
  JOBCTL_TRAP_STOP.

* ptracee enters do_jobct_trap().  PT_SEIZED is still not visible and
  it takes the path for the old behavior.

* ptracer SEIZE'd and expects PTRACE_EVENT_STOP but it gets the old
  no-siginfo trap.

> > and linking are protected by siglock
> 
> Hmm. Could you explain this? Why do want __ptrace_link under ->siglock ?

Because it's much simpler to assume that w/ siglock locked, everything
including ->parent is set up properly w.r.t. ->ptrace.

Thanks.

-- 
tejun

  reply	other threads:[~2011-09-11  2:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 21:40 [PATCH v2] Make PTRACE_SEIZE set ptrace options specified in 'data' parameter Denys Vlasenko
2011-09-07 23:55 ` Pedro Alves
2011-09-08  0:44 ` Tejun Heo
2011-09-08 18:17   ` Oleg Nesterov
2011-09-11  2:05     ` Tejun Heo [this message]
2011-09-11 18:14       ` Oleg Nesterov
2011-09-13  8:00         ` Tejun Heo

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=20110911020523.GL29319@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --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 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.