|
From: John R. <jr...@bi...> - 2012-12-12 20:02:42
|
> I am trying to run Valgrind on a Linux program which sets its own hooks for certain libc functions (malloc, calloc and free among them). > > To that effect, instead of using LD_PRELOAD, and for reasons I believe are not really relevant for the discussion, the first bytes of the code from these function are overwritten with a jump to a hijacking function. [snip] > This hooking mechanism has been tested thoroughly in different architectures. Additionally, the program runs just fine under Valgrind when disabling it. Here is the output when running it under Valgrind (i686/Linux) with hijacking enabled: Read and understand valgrind's code for re-direction. Apply some low-level debugger such as gdb (or perhaps valgrind's internal vgdb) to see what actually happens. Or, use LD_PRELOAD, which is the "blessed" mechanism for hooking. It works! and it takes only a few hours to try. See the thread in [valgrind-users] Subject: __malloc_hook by Amir Szekely on 2012-10-19, my response on Oct.22, and Amir's confirmation of success on Oct.23 (which includes his actual code.) -- |