Re: [DynInst_API:] Problems in instrumenting malloc


Date: Tue, 26 Jul 2016 10:12:41 -0500
From: John Detter <jdetter@xxxxxxxx>
Subject: Re: [DynInst_API:] Problems in instrumenting malloc

Martijn,

Your issue was fixed by Xiaozhu. You should be able to get the latest build from the master branch on our Github page, which includes the jump table parsing fix.

Let us know if it works for you,

-- John


On 7/21/2016 10:58 AM, Martijn wrote:

Cool! Thanks for looking into this.

I'll post another question on the mailing list regarding oneTimeCode in an exitCallback not working...

One minor in the latest manual, not sure if you are responsible for that: endInsertionSet should be finalizeInsertionSet in the text about this if I understand correctly.

Cheers,
 Martijn


On Jul 21, 2016 17:38, "John Detter" <jdetter@xxxxxxxx> wrote:

Martijn,

It looks like it's a jump table issue that is specific to the lib.so.6 that is shipped on Ubuntu. We have someone looking at it that knows how to fix jump table issues so we should have it figured out pretty soon.

If you would like to follow our progress, we have a thread on Github:

https://github.com/dyninst/dyninst/issues/126

I will send another reminder to the developer and I will let you know when the issue is fixed.

In the mean time, if there's anything else that comes up let me know,

-- John


On 7/21/2016 4:00 AM, Martijn wrote:
Hi John,

Did you manage to reproduce the issue? anything I can do to help to nail this?

Thanks. Best regards,
 Martijn

On Mon, Jul 18, 2016 at 6:09 PM, John Detter <jdetter@xxxxxxxx> wrote:

Martijn,

What are you using as your mutatee? e.g. what is the command you're using to run the tutorial?

-- John


On 7/18/2016 8:50 AM, Martijn wrote:
Hello,

I am looking at the DynInst API to instrument applications to detect memory errors. Very impressed with the platform independence of the API thus far.

Studying the maxarg.C tutorial code on http://www.paradyn.org/tutorial/ with DynInst 9.2.0 on Ubuntu 16.04 Desktop and gcc 5.3.1, I encounter two issues, the second blocking me:

1) The maxarg tutorial tries to add a snippet to malloc() in libc.so. It tries to find the malloc function in the module with substring "libc" using findModule(). As I understand the API, this will find the module of libc.so.6, but malloc() may well be implemented in a separate source file, and hence another module name. I corrected the example by first obtaining the libc.so.6 BPatch_object, and then using findFunction on the object, which walks over all modules in the libc.so.6. A findObject() convenience function on the BPatch_image would be nice here.

2) Still, the example cannot find the function malloc() in the libc object. obj->findFunction("malloc") works on all modules in the libc object, but fails to find malloc. It does work for free(), returning "__GI___libc_free" as the function name in /lib/x86_64-linux-gnu/libc-2.23.so.

malloc seems to be present in libc:

$ readelf -s /lib/x86_64-linux-gnu/libc-2.23.so | grep malloc

ÂÂ 443: 0000000000083550ÂÂ 414 FUNCÂÂÂ GLOBAL DEFAULTÂÂ 13 __libc_malloc@@GLIBC_2.2.5
ÂÂ 550: 0000000000086e70ÂÂÂ 24 FUNCÂÂÂ WEAKÂÂ DEFAULTÂÂ 13 malloc_info@@GLIBC_2.10
ÂÂ 820: 0000000000086560ÂÂ 474 FUNCÂÂÂ WEAKÂÂ DEFAULTÂÂ 13 malloc_stats@@GLIBC_2.2.5
ÂÂ 992: 0000000000083850ÂÂ 539 FUNCÂÂÂ WEAKÂÂ DEFAULTÂÂ 13 malloc_get_state@@GLIBC_2.2.5
 1088: 00000000003c3b10 8 OBJECT WEAK DEFAULT 33 __malloc_hook@@GLIBC_2.2.5
 1185: 0000000000083550 414 FUNC GLOBAL DEFAULT 13 malloc@@GLIBC_2.2.5
 1221: 00000000000845f0 498 FUNC WEAK DEFAULT 13 malloc_usable_size@@GLIBC_2.2.5
 1467: 0000000000086170 705 FUNC WEAK DEFAULT 13 malloc_trim@@GLIBC_2.2.5
 1787: 00000000003c57b0 8 OBJECT WEAK DEFAULT 34 __malloc_initialize_hook@@GLIBC_2.2.5
 2087: 00000000000856b0 1320 FUNC WEAK DEFAULT 13 malloc_set_state@@GLIBC_2.2.5

And my test program explicitly calls malloc:

$ nm -g test1/test |grep malloc
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ U malloc@@GLIBC_2.2.5

Any ideas what I do wrong here to try to find and instrument malloc()? I hope you can help me further.

Thanks,

Martijn

martijn@xxxxxxxxxxxxxxxxx


_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api




[← Prev in Thread] Current Thread [Next in Thread→]