|
From: Zhang, J. <Jie...@an...> - 2009-02-07 17:28:59
|
Hi,
When using valgrind on the below program on a AMD64 machine
int main ()
{
return 0;
}
I got
$ valgrind --track-origins=yes ./test
==9549== Memcheck, a memory error detector.
==9549== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==9549== Using LibVEX rev 1878, a library for dynamic binary translation.
==9549== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==9549== Using valgrind-3.4.0-Debian, a dynamic binary instrumentation framework.
==9549== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==9549== For more details, rerun with: -v
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x4015D37: strlen (in /lib/ld-2.9.so)
==9549== by 0x4004F72: fillin_rpath (in /lib/ld-2.9.so)
==9549== by 0x40082F8: _dl_init_paths (in /lib/ld-2.9.so)
==9549== by 0x4002FBB: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4008264: _dl_init_paths (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x4015AFE: index (in /lib/ld-2.9.so)
==9549== by 0x400731A: expand_dynamic_string_token (in /lib/ld-2.9.so)
==9549== by 0x40078D5: _dl_map_object (in /lib/ld-2.9.so)
==9549== by 0x40017AA: map_doit (in /lib/ld-2.9.so)
==9549== by 0x400D455: _dl_catch_error (in /lib/ld-2.9.so)
==9549== by 0x40016AE: do_preload (in /lib/ld-2.9.so)
==9549== by 0x4003BAF: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4003A81: dl_main (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x4015B09: index (in /lib/ld-2.9.so)
==9549== by 0x400731A: expand_dynamic_string_token (in /lib/ld-2.9.so)
==9549== by 0x40078D5: _dl_map_object (in /lib/ld-2.9.so)
==9549== by 0x40017AA: map_doit (in /lib/ld-2.9.so)
==9549== by 0x400D455: _dl_catch_error (in /lib/ld-2.9.so)
==9549== by 0x40016AE: do_preload (in /lib/ld-2.9.so)
==9549== by 0x4003BAF: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4003A81: dl_main (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x4015B14: index (in /lib/ld-2.9.so)
==9549== by 0x400731A: expand_dynamic_string_token (in /lib/ld-2.9.so)
==9549== by 0x40078D5: _dl_map_object (in /lib/ld-2.9.so)
==9549== by 0x40017AA: map_doit (in /lib/ld-2.9.so)
==9549== by 0x400D455: _dl_catch_error (in /lib/ld-2.9.so)
==9549== by 0x40016AE: do_preload (in /lib/ld-2.9.so)
==9549== by 0x4003BAF: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4003A81: dl_main (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x4015D51: strlen (in /lib/ld-2.9.so)
==9549== by 0x4004DE5: local_strdup (in /lib/ld-2.9.so)
==9549== by 0x40078D5: _dl_map_object (in /lib/ld-2.9.so)
==9549== by 0x40017AA: map_doit (in /lib/ld-2.9.so)
==9549== by 0x400D455: _dl_catch_error (in /lib/ld-2.9.so)
==9549== by 0x40016AE: do_preload (in /lib/ld-2.9.so)
==9549== by 0x4003BAF: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4003A81: dl_main (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x4015D51: strlen (in /lib/ld-2.9.so)
==9549== by 0x400A16E: _dl_new_object (in /lib/ld-2.9.so)
==9549== by 0x4005FD7: _dl_map_object_from_fd (in /lib/ld-2.9.so)
==9549== by 0x400797C: _dl_map_object (in /lib/ld-2.9.so)
==9549== by 0x40017AA: map_doit (in /lib/ld-2.9.so)
==9549== by 0x400D455: _dl_catch_error (in /lib/ld-2.9.so)
==9549== by 0x40016AE: do_preload (in /lib/ld-2.9.so)
==9549== by 0x4003BAF: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4003A81: dl_main (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x400A8E9: _dl_relocate_object (in /lib/ld-2.9.so)
==9549== by 0x400380A: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x400A770: _dl_relocate_object (in /lib/ld-2.9.so)
==9549==
==9549== Conditional jump or move depends on uninitialised value(s)
==9549== at 0x400A8F6: _dl_relocate_object (in /lib/ld-2.9.so)
==9549== by 0x400380A: dl_main (in /lib/ld-2.9.so)
==9549== by 0x4013F84: _dl_sysdep_start (in /lib/ld-2.9.so)
==9549== by 0x4001348: _dl_start (in /lib/ld-2.9.so)
==9549== by 0x4000A97: (within /lib/ld-2.9.so)
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x400A770: _dl_relocate_object (in /lib/ld-2.9.so)
==9549==
==9549== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
==9549== malloc/free: in use at exit: 0 bytes in 0 blocks.
==9549== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==9549== For counts of detected errors, rerun with: -v
==9549== All heap blocks were freed -- no leaks are possible.
My libc is glibc 2.9-0exp2 from Debian experimental. I looked at
==9549== Uninitialised value was created by a stack allocation
==9549== at 0x4003A81: dl_main (in /lib/ld-2.9.so)
Its source code is
char *list = strdupa (preloadlist);
strdupa is defined as
# define strdupa(s) \
(__extension__ \
({ \
__const char *__old = (s); \
size_t __len = strlen (__old) + 1; \
char *__new = (char *) __builtin_alloca (__len); \
(char *) memcpy (__new, __old, __len); \
}))
So it looks like that the allocaed memory has been initialized.
I don't know if it's a bug of valgrind or something else. Should I report a bug of this for valgrind?
Thanks,
Jie
|
|
From: Julian S. <js...@ac...> - 2009-02-07 17:58:50
|
> My libc is glibc 2.9-0exp2 from Debian experimental. I looked at I think that is probably the cause of the problem. Valgrind 3.4.x works fine with glibc 2.9, but the glibc version needs to be known at build time. If I had to guess, I would say your system originally had glibc-2.8, and valgrind installed, and you upgraded to glibc-2.9 without rebuilding Valgrind. Yes? If that's a correct analysis, I suggest you download and build the 3.4.1 pre-release snapshot available at http://valgrind.org/downloads and see if that works properly. J |
|
From: Jie Z. <jie...@an...> - 2009-02-09 03:43:57
|
Hi Julian, Julian Seward wrote: > >> My libc is glibc 2.9-0exp2 from Debian experimental. I looked at > > I think that is probably the cause of the problem. Valgrind 3.4.x > works fine with glibc 2.9, but the glibc version needs to be known > at build time. If I had to guess, I would say your system originally > had glibc-2.8, and valgrind installed, and you upgraded to glibc-2.9 > without rebuilding Valgrind. Yes? > > If that's a correct analysis, I suggest you download and build the > 3.4.1 pre-release snapshot available at http://valgrind.org/downloads > and see if that works properly. > You are right. After I rebuilt the valgrind, it works properly. Thanks! Jie |