public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>, Project Archer <archer@sourceware.org>
Subject: Re: ptrace improvement: PTRACE_O_INHERIT
Date: Wed, 16 Feb 2011 18:28:00 -0000	[thread overview]
Message-ID: <20110216182807.CA9491806E0@magilla.sf.frob.com> (raw)
In-Reply-To: Jan Kratochvil's message of  Wednesday, 16 February 2011 17:02:09 +0100 <20110216160209.GA19339@host1.dyn.jankratochvil.net>

> That may be too asynchronous.  After GDB/gcore/etc. finishes new PTRACE_ATTACH
> must complete successfully.  I never know if it is already guaranteed or not
> but in practice it works now.

Sorry if I was unclear, that is not the kind of asynchrony I was talking
about.  It is guaranteed now that when PTRACE_DETACH succeeds, the tracee
is detached and can be attached anew.  That would be true of what I
suggested also.  The asynchrony I mean is the good kind: that it doesn't
have to be stopped for you to detach it.  

There is nothing special for a debugger to worry about with this
asynchrony unless it uses multiple threads where one thread calls wait*
while another thread calls ptrace.  In that case, the debugger's wait*
thread could see a stop result that appears to be after its other thread
detached the same tracee.  (That is already true now with PTRACE_DETACH.)
If the debugger's own wait* call is strictly ordered after its detaching
ptrace call, there can be no such confusion.

> If there is no PTRACE_DETACH_ALL_TIDS(pid) and PTRACE_O_THREAD_INHERIT is in
> use GDB probably has to repeatedly iterate /proc/PID/task/*/status till all
> have TracerPid == 0.

Indeed.  That seems undesireable.

> > the attach-group implementation will be sufficiently hairy that the kernel
> > community would demand that we do some simpler incremental changes first
> > before attempting it (such as what I proposed for ATTACH_NOSTOP, which
> > eliminates the SIGSTOP and rolls in atomic option-setting).
> 
> thread_db_find_new_threads_2 already does an ugly loop of repeated threads
> finding.  There are also some failures that can be probably fixed by changing
> td_ta_thr_iter to readdir(/proc/PID/task) (RH#677654).  There are some pending
> bugs in GDB about it.

I take that to mean that you do not see a strong demand for a
group-attach feature, though having one would simplify things.
(But since GDB will never get rid of its code to support older
kernels, perhaps such simplification doesn't really help much
in practice.)


Thanks,
Roland

  reply	other threads:[~2011-02-16 18:28 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 22:39 ptrace improvement ideas Roland McGrath
2011-02-04 18:56 ` Oleg Nesterov
2011-02-04 18:58   ` Roland McGrath
2011-02-07 21:11 ` Jan Kratochvil
2011-02-08  1:58   ` Roland McGrath
2011-02-08 20:41     ` Jan Kratochvil
2011-02-09  2:48       ` Roland McGrath
2011-02-08 21:07     ` Oleg Nesterov
2011-02-08 23:18       ` hw_breakpoint userland interface Roland McGrath
2011-02-10 21:03         ` Oleg Nesterov
2011-02-10 21:14           ` Roland McGrath
2011-02-11 20:17             ` Oleg Nesterov
2011-02-10 20:00 ` ptrace improvement: PTRACE_O_INHERIT Oleg Nesterov
2011-02-11 19:24   ` Roland McGrath
2011-02-11 20:46     ` Oleg Nesterov
2011-02-12  0:59       ` Roland McGrath
2011-02-12 19:11         ` Oleg Nesterov
2011-02-14 19:31           ` Roland McGrath
2011-02-14 19:46             ` Oleg Nesterov
2011-02-15  0:36               ` Roland McGrath
2011-02-15 13:16                 ` Oleg Nesterov
2011-02-15 21:43                   ` Jan Kratochvil
2011-02-15 21:56                     ` Roland McGrath
2011-02-16 19:42                       ` Oleg Nesterov
2011-02-16 19:45                         ` Roland McGrath
2011-02-16 20:09                           ` Oleg Nesterov
2011-02-16 20:16                             ` Roland McGrath
2011-02-19 19:48                             ` Jan Kratochvil
2011-02-19 20:37                               ` Oleg Nesterov
2011-02-20  8:18                                 ` Jan Kratochvil
2011-02-20 21:05                                   ` Oleg Nesterov
2011-02-21 19:54                                 ` Roland McGrath
2011-02-22 19:39                                   ` Oleg Nesterov
2011-02-22 20:49                                     ` Roland McGrath
2011-02-22 21:10                                       ` Oleg Nesterov
2011-02-22 22:16                                         ` Roland McGrath
2011-02-21 19:44                               ` Roland McGrath
2011-02-15 22:02                     ` Roland McGrath
2011-02-16 16:02                       ` Jan Kratochvil
2011-02-16 18:28                         ` Roland McGrath [this message]
2011-02-16 20:00                           ` Oleg Nesterov
2011-02-16 20:07                             ` Roland McGrath
2011-02-16 20:32                               ` Oleg Nesterov
2011-02-16 19:48                       ` Oleg Nesterov
2011-02-16 20:02                         ` Roland McGrath
2011-02-16 20:15                           ` Oleg Nesterov
2011-02-16 20:31                             ` Roland McGrath
2011-02-16 21:04                               ` Oleg Nesterov
2011-02-16 21:51                                 ` Roland McGrath
2011-02-16 19:38                     ` Oleg Nesterov
2011-02-16 19:40                       ` Roland McGrath
2011-02-15 22:17                   ` Roland McGrath
2011-02-16 20:48                     ` Oleg Nesterov
2011-02-16 11:31 ` ptrace improvement ideas (QPassSignals) Jan Kratochvil
2011-02-16 18:36   ` Roland McGrath
2011-02-16 20:21     ` Oleg Nesterov
2011-02-18 20:24       ` Oleg Nesterov

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=20110216182807.CA9491806E0@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=oleg@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 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 read-only IMAP folder(s) and NNTP newsgroup(s).