Re: [DynInst_API:] new segfault in ELF xlatetom on powerpc


Date: Wed, 30 Nov 2016 23:12:33 +0000
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] new segfault in ELF xlatetom on powerpc
Interesting. With the system libelf on po (looks to be 0.158, ppc-little endian) everything is fine. And with x86_64 elfutils 0.161 is fine (my RHEL6 system). 0.163 is fine on Xiaozhu's RHEL7 system (also x86_64). I'm using your compare unit test, Mark, so we're hitting Symtab::openFile and doing real work besides; I'm seeing reasonable symbols coming out, too.

Do you have any of these versions handy to cross-check against? (I mean, I'm sure you do on po, but that's not the most useful of reproducers if it's an elfutils version issue.)

--bw

________________________________________
From: Dyninst-api <dyninst-api-bounces@xxxxxxxxxxx> on behalf of Mark W. Krentel <krentel@xxxxxxxx>
Sent: Wednesday, November 30, 2016 4:31 PM
To: dyninst-api@xxxxxxxxxxx
Subject: [DynInst_API:] new segfault in ELF xlatetom on powerpc

And now I'm seeing a different segfault inside Elf_X_Data::xlatetom().
This is with elfutils-0.167.

This happens only on powerpc, not on x86.

#0  .memcpy () at ../sysdeps/powerpc/powerpc64/power7/memcpy.S:114

#1  0x00000fff809f5148 in Dyninst::Elf_X_Data::xlatetom
(this=0xfffe652ca20,
     encode=<optimized out>)
     at
/home/krentel/newelf/externals/BUILD-48/symtabAPI/dyninst/elf/src/Elf_X.C:901

#2  0x00000fff80b2ff50 in Dyninst::SymtabAPI::Object::loaded_elf
(this=this@entry=0x100019502c0,
     txtaddr=@0xfffe652cd68: 268438016, dataddr=@0xfffe652cd60: 268506096,
     bssscnp=@0xfffe652cda0: 0x0, symscnp=@0xfffe652cd98: 0x0,
strscnp=@0xfffe652cd90: 0x0,
     stabscnp=@0xfffe652cd88: 0x0, stabstrscnp=@0xfffe652cd80: 0x0,
     stabs_indxcnp=@0xfffe652cd78: 0x0, stabstrs_indxcnp=@0xfffe652cd70:
0x0,
     rel_plt_scnp=@0xfffe652cd58: 0x10001952d50,
plt_scnp=@0xfffe652cd50: 0x0,
     got_scnp=@0xfffe652cd48: 0x0, dynsym_scnp=@0xfffe652cd40:
0x10001952c60,
     dynstr_scnp=@0xfffe652cd38: 0x10001952c90,
dynamic_scnp=@0xfffe652cd30: 0x10001952f60,
     eh_frame=@0xfffe652cd28: 0x10001952e70, gcc_except=@0xfffe652cd20:
0x10001952ea0,
     interp_scnp=@0xfffe652cd18: 0x10001952bd0, opd_scnp=@0xfffe652cd10:
0x0)
     at
/home/krentel/newelf/externals/BUILD-48/symtabAPI/dyninst/symtabAPI/src/Object-elf.C:628

#3  0x00000fff80b360a4 in Dyninst::SymtabAPI::Object::load_object (
     this=this@entry=0x100019502c0, alloc_syms=alloc_syms@entry=true)
     at
/home/krentel/newelf/externals/BUILD-48/symtabAPI/dyninst/symtabAPI/src/Object-elf.C:1523

#4  0x00000fff80b370c8 in Dyninst::SymtabAPI::Object::Object
(this=0x100019502c0,
     mf_=0x10001950270, err_func=<optimized out>, alloc_syms=<optimized
out>, st=<optimized out>)
     at
/home/krentel/newelf/externals/BUILD-48/symtabAPI/dyninst/symtabAPI/src/Object-elf.C:2930

#5  0x00000fff80adce54 in Dyninst::SymtabAPI::Symtab::Symtab
(this=0x1000194f050, filename=...,
     defensive_bin=<optimized out>, err=@0xfffe652d089: false)
     at
/home/krentel/newelf/externals/BUILD-48/symtabAPI/dyninst/symtabAPI/src/Symtab.C:1270

#6  0x00000fff80add284 in Dyninst::SymtabAPI::Symtab::openFile
(obj=@0x10011678: 0x0,
     filename=..., def_binary=<optimized out>)
     at
/home/krentel/newelf/externals/BUILD-48/symtabAPI/dyninst/symtabAPI/src/Symtab.C:2102

#7  0x0000000010000cf0 in main (argc=<optimized out>, argv=<optimized
out>) at parse.cpp:145

Again, this happens with the trivial program of Symtab::openFile() run
on itself or /bin/ls, anything.

I tried looking back in the git log tree to see where this came from.

*   commit d2f0f1051e5caf605471fa19532334fcce9bb508
|\  Merge: 99e8b92 f74a535
| | Author: John Detter <jdetter@xxxxxxxx>
| | Date:   Tue Nov 29 15:57:40 2016 -0600
| |
| |     Merge pull request #277 from dyninst/release9.2/fixes/ppc-fixes
| |
| |     Cleanup ppc (and old gcc) issues
| |
| * commit f74a535845c7b66d239e29acbbf8fc2a9462b195
| | Author: John Detter <jdetter@xxxxxxxx>
| | Date:   Tue Nov 29 15:08:44 2016 -0600
| |
| |     Removed references to nullptr
| |
| * commit f2c39832a32be92c1439b34aafeafbaf80e24f83
| | Author: Bill Williams <bill@xxxxxxxxxxx>
| | Date:   Thu Nov 17 12:40:46 2016 -0600
| |
| |     Stubs for fixing PPC binaries without OPD sections
| |
| * commit 116fccd72fd6ebcd16a091ea2196c1422ea4c15e
| | Author: Bill Williams <bill@xxxxxxxxxxx>
| | Date:   Thu Nov 17 11:33:36 2016 -0600
| |
| |     PPC build fixed
| |
* |   commit 99e8b9216b9e555563185391e4fd18256ab783d6
|\ \  Merge: 657f866 4b07213
| | | Author: Bill Williams <wwilliam47@xxxxxxxxx>
| | | Date:   Tue Nov 29 10:06:27 2016 -0700
| | |
| | |     Merge pull request #273 from ikitayama/myv9.2.0
| | |
| | |     Compiling DynInst v9.2.0 on arm64

The above stack trace is with master d2f0f1051e5 which is a merge of
two other commits.  But I get the same segfault in both of its
ancestors: f74a535845c and 99e8b9216b9.

So, I don't really know where this is coming from or how long the bug
has been around.  Maybe it's been there for a while and I just didn't
try it on powerpc.

I *think* I have all the prereqs right.  I'm sure I'm using
elfutils-0.167.  But perhaps I have something out of place.

It would be useful for someone else to try reproducing the bug.
All it takes is Symtab::openFile() on a powerpc binary.  This is a
power7 binary run on power7 (not cross-arch) compiled with g++ 4.8.5.

--Mark

_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
[← Prev in Thread] Current Thread [Next in Thread→]