From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27772 invoked by alias); 20 Feb 2011 21:05:34 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 27761 invoked by uid 22791); 20 Feb 2011 21:05:33 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Date: Sun, 20 Feb 2011 21:05:00 -0000 From: Oleg Nesterov To: Jan Kratochvil Cc: Roland McGrath , Project Archer Subject: Re: ptrace improvement: PTRACE_O_INHERIT Message-ID: <20110220205707.GA4894@redhat.com> References: <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> <20110219202921.GA12280@redhat.com> <20110220081758.GA7524@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110220081758.GA7524@host1.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-SW-Source: 2011-q1/txt/msg00083.txt.bz2 On 02/20, Jan Kratochvil wrote: > > On Sat, 19 Feb 2011 21:29:21 +0100, Oleg Nesterov wrote: > > 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. > > Maybe: > /* The thread has previously exited. We need to delete it > now because, for some vendor 2.4 kernels with NPTL > support backported, there won't be an exit event unless > it is the main thread. 2.6 kernels will report an exit > event for each thread that exits, as expected. */ > > There probably was a reason why it was once implemented. Probably yes... I tried to understand this code, but failed. I am not suprised, gdb is not trivial. But. This makes me think that Roland was right, gdb needs tgkill(). Otherwise, if the old kernel does not report the exit via WIFEXITED, then tkill(TID, 0) can succeed while the tracee has gone away. > Unfortunately GDB is > in use also on embedded targets with obsolete and patched Linux kernels so it > is not welcome to remove such code. Heh, I see. I always knew that the kernel hacking is simple compared to user-space development ;) Oleg.