|
From: Ashley P. <as...@qu...> - 2005-08-26 15:24:04
|
On Fri, 2005-08-26 at 07:25 -0700, Paul Pluzhnikov wrote:
> On 8/26/05, Ashley Pittman <as...@qu...> wrote:
>
> > I *thought* that prelinking worked my modifying the load base
> > address of the library and when you did prelink -u (undo) it reverted
> > it's changes to the file in place,
>
> That's correct. The PT_LOAD segment addresses and relocations are updated.
Thanks for the info, I thought that's what it was but I wasn't 100%
sure. It's quite a nice idea when it works.
> > this would imply that when the
> > library is in a prelinked state debugging is there but valgrind can't
> > extract it.
>
> That's what appears to be happening.
> However, when I tried prelinking some of my libraries, VG decoded
> the debug info just fine, so there is more to this apparent VG bug
> then just prelinking.
Ok, I've got a reproducer here, I wrote a simple test case which
provides dud memory to the initilisation function of the library,
valgrind correctly spots the dodgy reads but doesn't show the source
line.
I've removed the use of MPI, any parallel code and the intel compiler to
keep it simple.
The library's are open source LGPL but you need a password to download
them, if you email directly me or su...@qu... we can send you
one.
[root@stratum5 v]# prelink -a
prelink: /usr/lib/mpi/mpi_intel/bin/mping: Could not find one of the dependencies
prelink: /usr/lib/mpi/mpi_gnu/bin/mping: Could not find one of the dependencies
prelink: /usr/bin/emacs-21.3: COPY relocations don't point into .bss or .sbss section
[root@stratum5 v]# /home/duncant/valgrind_install/bin/valgrind a.out
==7211== Memcheck, a memory error detector.
==7211== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==7211== Using LibVEX rev 1283, a library for dynamic binary translation.
==7211== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==7211== Using valgrind-3.0.0.SVN, a dynamic binary instrumentation framework.
==7211== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==7211== For more details, rerun with: -v
==7211==
==7211== Conditional jump or move depends on uninitialised value(s)
==7211== at 0x1B911837: init_parseEnv (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x1B911CF1: elan_init (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x80484DF: main (in /root/v/a.out)
ELAN_EXCEPTION @ --: 6 (Initialisation error)
elan_init: Can't get capability from environment : 0 : Success
==7211==
==7211== Conditional jump or move depends on uninitialised value(s)
==7211== at 0x1B931D79: elan_exception (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x1B9119FC: init_getCap (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x1B911CF9: elan_init (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x80484DF: main (in /root/v/a.out)
==7211==
==7211== Conditional jump or move depends on uninitialised value(s)
==7211== at 0x1B931DC4: elan_exception (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x1B9119FC: init_getCap (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x1B911CF9: elan_init (in /usr/lib/qsnet/elan4/lib/libelan.so.1)
==7211== by 0x80484DF: main (in /root/v/a.out)
==7211==
==7211== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 28 from 3)
==7211== malloc/free: in use at exit: 2440 bytes in 3 blocks.
==7211== malloc/free: 3 allocs, 0 frees, 2440 bytes allocated.
==7211== For counts of detected errors, rerun with: -v
==7211== searching for pointers to 3 not-freed blocks.
==7211== checked 108936 bytes.
==7211==
==7211== LEAK SUMMARY:
==7211== definitely lost: 0 bytes in 0 blocks.
==7211== possibly lost: 0 bytes in 0 blocks.
==7211== still reachable: 2440 bytes in 3 blocks.
==7211== suppressed: 0 bytes in 0 blocks.
==7211== Reachable blocks (those to which a pointer was found) are not shown.
==7211== To see them, rerun with: --show-reachable=yes
Aborted (core dumped)
[root@stratum5 v]# prelink -u /usr/lib/qsnet/elan4/lib/libelan.so.1
[root@stratum5 v]# /home/duncant/valgrind_install/bin/valgrind a.out
==7215== Memcheck, a memory error detector.
==7215== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==7215== Using LibVEX rev 1283, a library for dynamic binary translation.
==7215== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==7215== Using valgrind-3.0.0.SVN, a dynamic binary instrumentation framework.
==7215== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==7215== For more details, rerun with: -v
==7215==
==7215== Conditional jump or move depends on uninitialised value(s)
==7215== at 0x1B911837: init_parseEnv (elan4/init.c:205)
==7215== by 0x1B911CF1: elan_init (elan4/init.c:384)
==7215== by 0x80484DF: main (in /root/v/a.out)
ELAN_EXCEPTION @ --: 6 (Initialisation error)
elan_init: Can't get capability from environment : 0 : Success
==7215==
==7215== Conditional jump or move depends on uninitialised value(s)
==7215== at 0x1B931D79: elan_exception (common/misc.c:232)
==7215== by 0x1B9119FC: init_getCap (elan4/init.c:261)
==7215== by 0x1B911CF9: elan_init (elan4/init.c:386)
==7215== by 0x80484DF: main (in /root/v/a.out)
==7215==
==7215== Conditional jump or move depends on uninitialised value(s)
==7215== at 0x1B931DC4: elan_exception (common/misc.c:239)
==7215== by 0x1B9119FC: init_getCap (elan4/init.c:261)
==7215== by 0x1B911CF9: elan_init (elan4/init.c:386)
==7215== by 0x80484DF: main (in /root/v/a.out)
==7215==
==7215== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 28 from 3)
==7215== malloc/free: in use at exit: 2440 bytes in 3 blocks.
==7215== malloc/free: 3 allocs, 0 frees, 2440 bytes allocated.
==7215== For counts of detected errors, rerun with: -v
==7215== searching for pointers to 3 not-freed blocks.
==7215== checked 108936 bytes.
==7215==
==7215== LEAK SUMMARY:
==7215== definitely lost: 0 bytes in 0 blocks.
==7215== possibly lost: 0 bytes in 0 blocks.
==7215== still reachable: 2440 bytes in 3 blocks.
==7215== suppressed: 0 bytes in 0 blocks.
==7215== Reachable blocks (those to which a pointer was found) are not shown.
==7215== To see them, rerun with: --show-reachable=yes
Aborted (core dumped)
[root@stratum5 v]# cat test.c
#include <elan/elan.h>
#include <malloc.h>
main () {
ELAN_FLAGS *i;
i = malloc(sizeof(*i));
elan_init(*i);
}
[root@stratum5 v]# ldd ./a.out
libelan.so.1 => /usr/lib/libelan.so.1 (0x003fe000)
libc.so.6 => /lib/tls/libc.so.6 (0x0011a000)
librmscall.so.1 => /usr/lib/librmscall.so.1 (0x006b9000)
libelanctrl.so.2 => /usr/lib/libelanctrl.so.2 (0x004e9000)
libelan4.so.1 => /usr/lib/libelan4.so.1 (0x007b0000)
/lib/ld-linux.so.2 (0x00101000)
|