public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Michael Trensch <mtrensch@googlemail.com>
Cc: binutils@sourceware.org
Subject: Re: objdump segfaults when dumping library with sources (arm-elf / arm-none-eabi)
Date: Fri, 29 Jul 2011 15:07:00 -0000	[thread overview]
Message-ID: <4E32C4B2.4050307@redhat.com> (raw)
In-Reply-To: <4E297117.7060105@gmail.com>

Hi Michael,

> First of all I am quite new to compiling binutils, etc. myself and I
> don't know if this is a compiler problem, generating wrong debugging
> information, or a binutils problem disassembling wrong.

Well first thank you for reporting this problem.  Secondly even if it 
does turn out to be a compiler problem, objdump should not be seg-faulting.

> My main problem is then objdump segfaults when dumping library files.

Which version of the binutils are you using ?  If you do not have the 
latest release (2.21) or (even better) the mainline development code, 
then it may be that this a bug that has already been fixed.

> In my case it was easily reproducible when executing "arm-elf-objdump -S
> libc.a".

The best way to solve this problem is to file a bug report with the 
binutils bugzilla system:

   http://sourceware.org/bugzilla

If you include a test case that can reproduce the problem, that will 
really help.


> The function get_map_sym_type() in "opcodes/arm-dis.c" was called
> with a disassemble info containing 4 sym_tabs, while n was 24.
> This results in an array out of bound access which may segfault.

This sounds like the underlying cause is some bogus debug info in the 
file.

> When I added validation of the input parameters the segfault was
> gone (and disassembly for this opcode seems to be skipped).

>   {
>     /* If the symbol is in a different section, ignore it.  */
> +  if (n>= info->symtab_size)
> +    return FALSE;
>     if (info->section != NULL&&  info->section != info->symtab[n]->section)

This seems OK, although I would have put the new code before the 
comment, not after it.

> After that I was able to dump the same library but the
> disassembly was missing.

OK - to go any further though we are really going to need a test case. 
And ideally a bug report in which to keep track of the work done in 
solving the problem.

Cheers
   Nick




  reply	other threads:[~2011-07-29 14:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 21:52 Michael Trensch
2011-07-29 15:07 ` Nick Clifton [this message]
2011-07-29 15:34   ` Michael Trensch

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=4E32C4B2.4050307@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=mtrensch@googlemail.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).