This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ptrace improvement: PTRACE_O_INHERIT


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]