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

It uses PTRACE_O_TRACECLONE so it should see a reusal of thread TID in the same
PID, although it seems to me it will just create a duplicate {PID, TID}.

Just currently there are enough bugreports about users hitting threading races
of GDB in real world so we do not have to think about more race possibilities.


Thanks,
Jan


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