[DynInst_API:] Segfault when calling the symtabAPI openFile function.


Date: Mon, 14 May 2012 10:15:14 -0700
From: Gary.Mohr@xxxxxxxx
Subject: [DynInst_API:] Segfault when calling the symtabAPI openFile function.
HI,

I am new to this list so if this is an incorrect use of the list, please
let me know.

I was chasing a problem in the HPCToolkit hpcfnbounds utility (which uses
symtabAPI) that resuls in a segfault and found the error in symtabAPI.  It
is in code that eventually gets called by the openFile function.  The error
occurred when trying to open the libibumad.so dynamic library on one of our
test systems in France but unfortunately I can not provide a test case that
will reproduce the problem because if I move that same library to a
different system (or even a different place on the same system) the problem
does not occur.  But luckily I think the problem should be pretty clear in
the code and the description and patch below should give you what you need
to fix it.

In the file symtabAPI/src/dyninst/symtabAPI/src/Object-elf.C there is code
that creates a vector of table pointers and then walks through it with a
for loop picking up the pointers and using them.  At the time of the seg
fault the vector has a size of 30 and a capacity of 32.  The segfault
occurs in the code that is trying to use the pointer picked up from an
index of 30 into the vector.  Since a vector of size 30 only has valid data
at indexes of 0-29 this reference should never have been made.  The code
tries to prevent using pointers from the vector that are not valid by
checking to make sure the vector index <= the vectors size but the check
should make sure the index is < the vectors size (the = allows the code to
take one more entry from the vector than really exists).

Here is a very simple patch to correct the problem:

(See attached file: patch-Object-elf.C)

Hope you can clean up this problem in your next release.

Thanks
Gary

Attachment: patch-Object-elf.C
Description: Binary data

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] Segfault when calling the symtabAPI openFile function., Gary . Mohr <=