From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28201 invoked by alias); 19 Feb 2011 20:37:38 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 28192 invoked by uid 22791); 19 Feb 2011 20:37:38 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_TG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Date: Sat, 19 Feb 2011 20:37:00 -0000 From: Oleg Nesterov To: Jan Kratochvil Cc: Roland McGrath , Project Archer Subject: Re: ptrace improvement: PTRACE_O_INHERIT Message-ID: <20110219202921.GA12280@redhat.com> References: <20110214193052.3EC8D1814BA@magilla.sf.frob.com> <20110214193812.GA20765@redhat.com> <20110215003551.BC1EA1802A2@magilla.sf.frob.com> <20110215130805.GA30742@redhat.com> <20110215214333.GA18086@host1.dyn.jankratochvil.net> <20110215215634.2665A1806E0@magilla.sf.frob.com> <20110216193356.GB15576@redhat.com> <20110216194534.2D39018020E@magilla.sf.frob.com> <20110216200110.GA17601@redhat.com> <20110219194758.GA8994@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110219194758.GA8994@host1.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-SW-Source: 2011-q1/txt/msg00081.txt.bz2 On 02/19, Jan Kratochvil wrote: > > On Wed, 16 Feb 2011 21:01:10 +0100, Oleg Nesterov wrote: > > On 02/16, Roland McGrath wrote: > > > If the process-wide PID (tgid) is not reused > > > ... > > > then tgkill does protect completely against TID reuse. > > > > How? sooner or later the process which creates/destroys a thread > > in a loop will reuse some pid number. > > (a) GDB tracks separately threads (libpthread-managed) and LWPs (TIDs). > (So the libthread_db TD_DEATH notification is offtopic for this mail.) > > (b) For LWPs it does not use PTRACE_O_TRACEEXIT. > /* Do not enable PTRACE_O_TRACEEXIT until GDB is more prepared to support > read-only process state. */ > (I do not know more regarding this comment.) > > Therefore it occasionally uses tkill (TID, 0) instead of PTRACE_O_TRACEEXIT. Cough. I still can't understand why gdb needs tkill(TID, 0). Please ignore, I know nothing about gdb implementation. However. With or without PTRACE_O_TRACEEXIT, the thread can't go away until ptracer does do_wait(WEXITED). And until it does do_wait() tkill() succeeds even if the tracee is dead/zombie. Oleg.