Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: "Tedeschi, Walfred" <walfred.tedeschi@intel.com>
Cc: Tom Tromey <tromey@redhat.com>, Pedro Alves <palves@redhat.com>,
	Yao Qi <yao@codesourcery.com>,
	"Mark Kettenis (mark.kettenis@xs4all.nl)"
	<mark.kettenis@xs4all.nl>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: FYI: gdbserver crash due to: [pushed] [PATCH V7 0/8] Intel(R) MPX register support
Date: Mon, 25 Nov 2013 12:24:00 -0000	[thread overview]
Message-ID: <20131125121757.GB3114@adacore.com> (raw)
In-Reply-To: <AC542571535E904D8E8ADAE745D60B191B1DACC6@IRSMSX104.ger.corp.intel.com>

Hello,

Just letting you guys know that I'm seeing a gdbserver crash
due to this bug, and that I am investigation - so that we don't
duplicate efforts. It's code that's completely new to me, so
I might take time figuring out what's wrong, hence the heads up.

FTR, I am on GNU/Linux Ubuntu 13.04 x86_64-linux.

To reproduce:

   % gdbserver :4444 simple_main

And then, start GDB elsewhere:

   % gdb simple_main
   (gdb) target remote :4444
   (gdb) cont

GDBserver crashes as follow:

    memory clobbered past end of allocated block
    [1]  + 26259 abort (core dumped)  /[...]/gdbserver :4444 simple_main

I think one needs to be in development mode in order to see the problem.

Also FTR, here are my notes so far:

| In linux-low.c:regsets_store_inferior_registers:
|
|       buf = xmalloc (regset->size);  <<<- size is 576
|
| ... and then calls:
|
|           regset->fill_function (regcache, buf);
|
| This goes to x86_fill_xstateregset, which is just a wrapper calling
| i387_cache_to_xsave. In i387_cache_to_xsave, we have:
|
|   struct i387_xsave *fp = (struct i387_xsave *) buf;
|
| This is where things get dicey because:
|
|     sizeof (struct i387_xsave) = 1040
|
| The first buffer overrun starts at:
|
|       if ((clear_bv & I386_XSTATE_AVX))
|         for (i = 0; i < num_xmm_registers; i++)
|           memset (((char *) &fp->ymmh_space[0]) + i * 16, 0, 16);
|
| And indeed, when looking at ymmh_space's offset, it's ... 576!

Now, I'll start looking at the discrepancy between regset-size
and sizeof (struct i387_xsave).

-- 
Joel

PS: Anyone else seeing this? Since the patch was applied several days
    ago, I would have thought that someone else might have hit that...


  parent reply	other threads:[~2013-11-25 12:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 13:11 Tedeschi, Walfred
2013-11-21 20:48 ` Pedro Alves
2013-11-22  8:41   ` Tedeschi, Walfred
2013-11-22 12:50   ` Tedeschi, Walfred
2013-11-22 13:41     ` Yao Qi
2013-11-22 13:51     ` Pedro Alves
2013-11-22 13:57       ` Tedeschi, Walfred
2013-11-22 14:31       ` Tedeschi, Walfred
2013-11-22 17:23     ` Tom Tromey
     [not found]       ` <AC542571535E904D8E8ADAE745D60B191B1DACC6@IRSMSX104.ger.corp.intel.com>
2013-11-25 12:24         ` Joel Brobecker [this message]
2013-11-25 12:51           ` gdbserver crash due to: " Tedeschi, Walfred

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=20131125121757.GB3114@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.com \
    --cc=walfred.tedeschi@intel.com \
    --cc=yao@codesourcery.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