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/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.


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