http://groups.google.co.nz/group/comp.os.linux.development.system/browse_thread/thread/73ef43a1c8096e9d#

Hello!

I'm using Gentoo Linux with
  kernel 2.6.24-gentoo-r8
  gcc 4.1.2
  glibc 2.8

I wrote the simplest C++ program and compiled it:

krive...@develop2 16:23:20 /tmp $ cat v.cpp
int main()
{
  return 0;

}

krive...@develop2 16:23:23 /tmp $ g++ -g v.cpp
krive...@develop2 16:23:26 /tmp $ g++ --version
g++ (GCC) 4.1.2 (Gentoo 4.1.2 p1.3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

krive...@develop2 16:23:28 /tmp $ ldd ./a.out
        linux-gate.so.1 =>  (0xb7eef000)
        libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libstdc+
+.so.6 (0xb7dec000)
        libm.so.6 => /lib/libm.so.6 (0xb7dc6000)
        libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/
libgcc_s.so.1 (0xb7dba000)
        libc.so.6 => /lib/libc.so.6 (0xb7c80000)
        /lib/ld-linux.so.2 (0xb7ef0000)
krive...@develop2 16:23:35 /tmp $ ls -l /lib/libc.so.6
lrwxrwxrwx 1 root root 11 Mar 28 15:31 /lib/libc.so.6 -> libc-2.8.so
krive...@develop2 16:23:45 /tmp $

So far, so good. Isn't it?

OK, lets run the program under valgrind:

krive...@develop2 16:23:45 /tmp $ valgrind --track-origins=yes ./
a.out
==6904== Memcheck, a memory error detector.
==6904== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et
al.
==6904== Using LibVEX rev 1878, a library for dynamic binary
translation.
==6904== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==6904== Using valgrind-3.4.0, a dynamic binary instrumentation
framework.
==6904== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et
al.
==6904== For more details, rerun with: -v
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x4015A3C: (within /lib/ld-2.8.so)
==6904==    by 0x4007B9E: (within /lib/ld-2.8.so)
==6904==    by 0x4003465: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x40078B1: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x4015A47: (within /lib/ld-2.8.so)
==6904==    by 0x4007B9E: (within /lib/ld-2.8.so)
==6904==    by 0x4003465: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x40078B1: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AB29: (within /lib/ld-2.8.so)
==6904==    by 0x40040F7: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AB31: (within /lib/ld-2.8.so)
==6904==    by 0x40040F7: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AFE9: (within /lib/ld-2.8.so)
==6904==    by 0x40040F7: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AC74: (within /lib/ld-2.8.so)
==6904==    by 0x40040F7: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AB29: (within /lib/ld-2.8.so)
==6904==    by 0x4003F36: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AB31: (within /lib/ld-2.8.so)
==6904==    by 0x4003F36: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== Conditional jump or move depends on uninitialised value(s)
==6904==    at 0x400AC74: (within /lib/ld-2.8.so)
==6904==    by 0x4003F36: (within /lib/ld-2.8.so)
==6904==    by 0x4014185: (within /lib/ld-2.8.so)
==6904==    by 0x400138E: (within /lib/ld-2.8.so)
==6904==    by 0x4000986: (within /lib/ld-2.8.so)
==6904==  Uninitialised value was created by a stack allocation
==6904==    at 0x400AA36: (within /lib/ld-2.8.so)
==6904==
==6904== ERROR SUMMARY: 9 errors from 9 contexts (suppressed: 0 from
0)
==6904== malloc/free: in use at exit: 0 bytes in 0 blocks.
==6904== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==6904== For counts of detected errors, rerun with: -v
==6904== All heap blocks were freed -- no leaks are possible.
krive...@develop2 16:23:59 /tmp $

As you can see valgrind detected a lot of conditional jumps
depending on uninitialised value.

All errors were found in /lib/ld-2.8.so, i.e. in system
component (part of glibc-2.8).

I run the same program on another server (2.6.27-gentoo-r7,
gcc-4.1.2, glibc-2.8) and got the following results:

r...@olimpico_work 16:33:18 /tmp # valgrind --track-origins=yes ./
a.out
==732== Memcheck, a memory error detector.
==732== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et
al.
==732== Using LibVEX rev 1878, a library for dynamic binary
translation.
==732== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==732== Using valgrind-3.4.0, a dynamic binary instrumentation
framework.
==732== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et
al.
==732== For more details, rerun with: -v
==732==
==732==
==732== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 1)
==732== malloc/free: in use at exit: 0 bytes in 0 blocks.
==732== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==732== For counts of detected errors, rerun with: -v
==732== All heap blocks were freed -- no leaks are possible.
r...@olimpico_work 16:33:20 /tmp #

As you can see there aren't any errors.

So, I guess something is wrong with the first server.
Any ideas?
What's wrong?

Thank you beforehand!

I found a solution!
It's required to rebuild valgrind after upgrading glibc.

I rebuilt it and now it works as expected.




Reply via email to