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

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to