Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v4 5/7] Add thread_db_notice_clone to gdbserver
Date: Fri, 29 Sep 2017 12:24:00 -0000	[thread overview]
Message-ID: <133e7d06-cda7-cd0b-aba8-0e91b16f52ba@redhat.com> (raw)
In-Reply-To: <20170816104143.0af5d91a@pinnacle.lan>

On 08/16/2017 06:41 PM, Kevin Buettner wrote:
> While working on a patch for fetching a thread handle in gdbserver, I
> ran into a circumstance in which tests in gdb.mi/mi-nsmoribund.exp
> would occasionally fail.  Over a large enough number of runs, it would
> fail roughly 2% of the time.
> 
> That thread handle patch caused find_one_thread() to be called on
> every stop.  find_one_thread() calls td_ta_map_lwp2thr() which, in
> turn, can cause ps_get_thread_area() to be called.
> ps_get_thread_area() makes a call to ptrace() for getting the thread
> area address.  If this should happen when the thread is not stopped,
> the call to ptrace will return error which in turn propogates back to
> find_one_thread().  find_one_thread() calls error() in this instance
> which causes the program to die.
> 
> This patch causes find_one_thread() to be called upon reciept of a
> clone event.  Since the clone is stopped, the circumstances described
> above cannot occur.
> 

FYI, issues like the described above still happened with the
patch as it was.  While both parent/child are stopped, we
weren't making sure that one of parent/child is the
current thread.  That lead to libthread_db -> proc-service
trying to access memory from a running or non-existing thread.

For me that resulted in occasional
gdb.threads/multi-create-ns-info-thr.exp failures.

The gdbserver buildslaves have been reporting the same
regression too, e.g.:
  https://sourceware.org/ml/gdb-testers/2017-q3/msg05653.html

Should be fixed now, with:
 https://sourceware.org/ml/gdb-patches/2017-09/msg00903.html
 https://sourceware.org/ml/gdb-patches/2017-09/msg00904.html

Thanks,
Pedro Alves


  reply	other threads:[~2017-09-29 12:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 16:25 [PATCH v4 0/7] Thread handle to thread info mapping Kevin Buettner
2017-08-16 17:35 ` [PATCH v4 1/7] Add target method for converting thread handle to thread_info struct pointer Kevin Buettner
2017-08-16 17:37 ` [PATCH v4 2/7] Add `thread_from_thread_handle' method to (Python) gdb.Inferior Kevin Buettner
2017-08-16 17:38 ` [PATCH v4 3/7] Documentation for Inferior.thread_from_thread_handle Kevin Buettner
2017-08-16 17:40 ` [PATCH v4 4/7] Test case " Kevin Buettner
2017-08-16 17:41 ` [PATCH v4 5/7] Add thread_db_notice_clone to gdbserver Kevin Buettner
2017-09-29 12:24   ` Pedro Alves [this message]
2017-08-16 17:43 ` [PATCH v4 6/7] Add thread_handle_to_thread_info support for remote targets Kevin Buettner
2017-08-16 17:44 ` [PATCH v4 7/7] Documentation for qXfer:threads:read handle attribute Kevin Buettner
2017-09-13  0:00 ` [PATCH v4 0/7] Thread handle to thread info mapping Kevin Buettner
2017-09-18 20:17 ` Simon Marchi
2017-09-21 18:56   ` Kevin Buettner
2017-09-21 18:57 ` Kevin Buettner

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=133e7d06-cda7-cd0b-aba8-0e91b16f52ba@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /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