This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH]13217 thread apply all detach throws a SEGFAULT


Hi Bilal,

The problem with this fix is that it handles one
specific crash, but is not a complete fix, as it
still leaves undefined behavior in place, which may
well manifest in similar crashes, or worse, random corruption.
The issue is that the command applies to each thread may
not remove _all_ threads (as detected by your patch), but cause
the currently iterated thread to exit, and thus, (at least)
this "tp->next" reference:

  for (tp = thread_list; tp; tp = tp->next)
                             ^^^^^^^^^^^^^
    if (thread_alive (tp))

Please coordinate with Ali Anwar @ Mentor.  He was
working on this issue a couple months back, and posted a
more complete patch, though review showed some more
work was necessary.

-- 
Pedro Alves


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