Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Bilal, Muhammad" <Muhammad_Bilal@mentor.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH]13217 thread apply all detach throws a SEGFAULT
Date: Mon, 14 Jan 2013 15:46:00 -0000	[thread overview]
Message-ID: <50F42832.9030700@redhat.com> (raw)
In-Reply-To: <97B73E257CC18646B0B5D3DD77DCBDD158EBC9@EU-MBX-02.mgc.mentorg.com>

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


      parent reply	other threads:[~2013-01-14 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <97B73E257CC18646B0B5D3DD77DCBDD158E8FD@EU-MBX-02.mgc.mentorg.com>
2013-01-14 13:38 ` Bilal, Muhammad
2013-01-14 15:25   ` Yao Qi
2013-01-14 15:41   ` Jan Kratochvil
2013-01-14 15:46   ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F42832.9030700@redhat.com \
    --to=palves@redhat.com \
    --cc=Muhammad_Bilal@mentor.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox