On Fri, 2014-10-10 at 08:11 -0400, Woodrow Barlow wrote:
> Hello Sir,
> 
> 
> Thank you for the help. I'm not entirely sure whether malloc is provided by 
> libc.so.0 or by ld-uClibc.so.0,
> so I've executed the requested command against both. I'm afraid I don't know 
> how to interpret the output,
>  but I've included it below:
> 
> 
>     $ readelf -d lib/libc.so.0 | grep SONAME
> 
>      0x0000000e (SONAME)                     Library soname: [libc.so.0]
>     $ readelf -d lib/ld-uClibc.so.0 | grep SONAME
>      0x0000000e (SONAME)                     Library soname: [ld-uClibc.so.0]
It is unlikely that ld-uClibc.so.0 does provide malloc.
So, probably it will be libc.so.0 that will provide it.



> Finally, as requested, I've run Valgrind with the debugging options against a 
> very simple application with malloc
It looks like the trace below has some lines truncated at column 90 and
joined with the next line(s).
E.g. some aspacemgr lines, or (more annoying :), the preload_string value.
A full not truncated trace would be better.

In any case, the trace shows that LD_PRELOAD is working, as we
see e.g. the line:
--1209-- Reading syms from 
/mnt/usb1_1/valgrind/lib/valgrind/vgpreload_memcheck-mips32-linux.so

The difference I see between a working run on a x86/linux and the trace below
is that no 'ACTIVE' redirection is being added.
On the x86/linux, we obtain some lines such as:
...
--2582--    ------ ACTIVE ------
...
--2582--     0x00286b40 (malloc              ) R-> (1001.0) 0x040078cc malloc

which means that the malloc function at 0x00286b40 (which the intercepted 
malloc in libc)
will be redirected to 0x040078cc, which is the 'intercepting malloc' in 
vgpreload_memcheck.

So, it looks like in your case, the valgrind files to preloaded are effectively 
preloaded,
that the redirection 'instructions' from these preloaded files are properly 
built,
giving the 'TOPSPEC' lines
but that they do not become active when the functions to intercepts are 
seen/found.

Looking at the code that makes such redirections active, this might be caused by
having a stripped library.
At least, in the x86 working case, I see:
--2582-- Reading syms from /lib/libc-2.11.2.so
while no such Reading Syms lines are visible in your trace for the libc.

Valgrind is supposed to detect that the dynamic linker was stripped,
and report a fatal error, and indicate to install the libc debug info.
but from what I can see, in the mips case, the warning is only given
for ld.so.3, while in your case, the loader soname is ld-uClibc.so.0,
as you do not use the "standard" linux loader.

So, at this state, the best guess is that you have a somewhat stripped
libraries and/or libraries without debug info, and/or syms for these
libs are not read properly
and that makes redirection not working.

There are ways to have more tracing, e.g. by doing

valgrind -v -v -v -d -d -d --debug-dump=syms --trace-symtab-patt=*libc* 
--trace-symtab=yes --trace-redir=yes --trace-malloc=yes

but I think this should be tried only after having verified that libc debug info
is available and/or that symbols are available in your lib.

Philippe




------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to