public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: "Keith Seitz" <keiths@redhat.com>
Cc: insight@sourceware.org
Subject: Re: [PATCH 2/2] Notice architecture changes even when the register window is not open.
Date: Fri, 06 Sep 2013 09:21:00 -0000	[thread overview]
Message-ID: <52299E2F.3030304@broadcom.com> (raw)
In-Reply-To: <5228D4B7.2020908@redhat.com>

On 05/09/2013 8:00 PM, Keith Seitz wrote:
> On 09/05/2013 07:27 AM, Andrew Burgess wrote:
>> I think this a bad situation to be in as, the reg-cache would ideally
>> be hidden from the user of "gdb_reginfo", and secondly, we only
>> really need to update the reg-cache once per architecture change, not
>> many times, which could happen if many users are all trying to keep
>> the reg-cache upto date.
> 
> Ouch. I believe at the time, this was never considered. I'm not even
> sure if it was possible. Nonetheless, it clearly *is* possible now, so
> thank you for tracking this down.
> 
> BTW, what architecture are you using to trigger this bug?

"Just" x86-64.  Once the assert in my previous patch is added it's
easy to see a failure.  I configure gdb with "--enable-libmcheck
--enable-targets=all".

$ uname -a
Linux HOSTNAME 2.6.18-274.17.1.el5 #1 SMP Wed Jan 4 22:45:44 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
$ cat hello.c
#include <stdio.h>

int
main ()
{  
  printf ("Hello World\n");

  return 0;
}
$ gcc --version
gcc (GCC) 4.7.2
$ gcc -g -o hello.x86 hello.c
$ gdb -i insight
# Then ...
#   File > Open > <Select: hello.x86>
#   Run Button (Stops at start of main)
#   Registers Button (Assert Fires)

With the assertion removed, the original SEGV I saw was triggered
by: once the register window had opened up I modified the contents of 
the rsp register to "0x0", hit return, then closed the register window.
Next I clicked the "Next" button (I wanted to see insight handle a SEGV
in the target application), I see a warning that the target has received a 
SIGSEGV, click OK, and then insight crashes, also with a SEGV.

Phew! Obviously there's going to be some randomness depending on memory
layout by the compiler, so it's you might not see the exact behaviour I
saw...

HTH
Andrew


  reply	other threads:[~2013-09-06  9:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 14:24 [PATCH 0/2] Memory corruption caused by failure to notice architecture change Andrew Burgess
2013-09-05 14:26 ` [PATCH 1/2] Add an assert that we're not overflowing the register cache Andrew Burgess
2013-09-05 18:55   ` Keith Seitz
2013-09-06  9:36     ` Andrew Burgess
2013-09-05 14:27 ` [PATCH 2/2] Notice architecture changes even when the register window is not open Andrew Burgess
2013-09-05 19:53   ` Keith Seitz
2013-09-06  9:21     ` Andrew Burgess [this message]
2013-09-06  9:40     ` Andrew Burgess

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=52299E2F.3030304@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=insight@sourceware.org \
    --cc=keiths@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).