Bug#588997: Valgrind suppression fail is outdated - valgrind reports on reachable memory with pthreads at exit

2010-07-14 Thread Pauli Sundberg
Package: valgrind
Version: 1:3.3.1-3
Severity: normal

Program (copy paste from https://computing.llnl.gov/tutorials/pthreads/)
#include pthread.h
#include stdio.h
#define NUM_THREADS 5

void *PrintHello(void *threadid)
{
   long tid;
   tid = (long)threadid;
   printf(Hello World! It's me, thread #%ld!\n, tid);
   pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
   pthread_t threads[NUM_THREADS];
   int rc;
   long t;
   for(t=0; tNUM_THREADS; t++){
  printf(In main: creating thread %ld\n, t);
  rc = pthread_create(threads[t], NULL, PrintHello, (void *)t);
  if (rc){
 printf(ERROR; return code from pthread_create() is %d\n, rc);
 exit(-1);
  }
   }
   pthread_exit(NULL);
}



sundb...@fs1:~$ valgrind   --error-exitcode=1 --leak-check=full 
--show-reachable=yes --gen-suppressions=all ./silly  
==32444== Memcheck, a memory error detector.
==32444== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==32444== Using LibVEX rev 1854, a library for dynamic binary translation.
==32444== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==32444== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation 
framework.
==32444== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==32444== For more details, rerun with: -v
==32444== 
In main: creating thread 0
In main: creating thread 1
Hello World! It's me, thread #1!
Hello World! It's me, thread #0!
In main: creating thread 2
Hello World! It's me, thread #2!
In main: creating thread 3
Hello World! It's me, thread #3!
In main: creating thread 4
Hello World! It's me, thread #4!
==32444== 
==32444== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 2)
==32444== malloc/free: in use at exit: 1,588 bytes in 10 blocks.
==32444== malloc/free: 10 allocs, 0 frees, 1,588 bytes allocated.
==32444== For counts of detected errors, rerun with: -v
==32444== searching for pointers to 10 not-freed blocks.
==32444== checked 42,017,180 bytes.
==32444== 
==32444== 19 bytes in 1 blocks are still reachable in loss record 1 of 6
==32444==at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==32444==by 0x400A551: (within /lib/ld-2.7.so)
==32444==by 0x4005FB2: (within /lib/ld-2.7.so)
==32444==by 0x4007E0C: (within /lib/ld-2.7.so)
==32444==by 0x4011B46: (within /lib/ld-2.7.so)
==32444==by 0x400DA15: (within /lib/ld-2.7.so)
==32444==by 0x401154D: (within /lib/ld-2.7.so)
==32444==by 0x41652A1: (within /lib/i686/cmov/libc-2.7.so)
==32444==by 0x400DA15: (within /lib/ld-2.7.so)
==32444==by 0x4165464: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
==32444==by 0x403FDC6: pthread_cancel_init (in 
/lib/i686/cmov/libpthread-2.7.so)
==32444==by 0x403FEF0: _Unwind_ForcedUnwind (in 
/lib/i686/cmov/libpthread-2.7.so)
{
   insert a suppression name here
   Memcheck:Leak
   fun:malloc
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/i686/cmov/libc-2.7.so
   obj:/lib/ld-2.7.so
   fun:__libc_dlopen_mode
   fun:pthread_cancel_init
   fun:_Unwind_ForcedUnwind
}
==32444== 
==32444== 
==32444== 19 bytes in 1 blocks are still reachable in loss record 2 of 6
==32444==at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==32444==by 0x4004D7E: (within /lib/ld-2.7.so)
==32444==by 0x400809B: (within /lib/ld-2.7.so)
==32444==by 0x4011B46: (within /lib/ld-2.7.so)
==32444==by 0x400DA15: (within /lib/ld-2.7.so)
==32444==by 0x401154D: (within /lib/ld-2.7.so)
==32444==by 0x41652A1: (within /lib/i686/cmov/libc-2.7.so)
==32444==by 0x400DA15: (within /lib/ld-2.7.so)
==32444==by 0x4165464: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
==32444==by 0x403FDC6: pthread_cancel_init (in 
/lib/i686/cmov/libpthread-2.7.so)
==32444==by 0x403FEF0: _Unwind_ForcedUnwind (in 
/lib/i686/cmov/libpthread-2.7.so)
==32444==by 0x403D900: __pthread_unwind (in 
/lib/i686/cmov/libpthread-2.7.so)
{
   insert a suppression name here
   Memcheck:Leak
   fun:malloc
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/ld-2.7.so
   obj:/lib/i686/cmov/libc-2.7.so
   obj:/lib/ld-2.7.so
   fun:__libc_dlopen_mode
   fun:pthread_cancel_init
   fun:_Unwind_ForcedUnwind
   fun:__pthread_unwind
}
==32444== 
==32444== 
==32444== 28 bytes in 1 blocks are still reachable in loss record 3 of 6
==32444==at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==32444==by 0x400C355: (within /lib/ld-2.7.so)
==32444==by 0x4011BA6: (within /lib/ld-2.7.so)
==32444==by 0x400DA15: (within /lib/ld-2.7.so)
==32444==by 0x401154D: (within /lib/ld-2.7.so)
==32444==by 0x41652A1: (within /lib/i686/cmov/libc-2.7.so)
==32444==by 0x400DA15: (within /lib/ld-2.7.so)
==32444==by 0x4165464: __libc_dlopen_mode (in /lib/i686/cmov/libc-2.7.so)
==32444==by 0x403FDC6: pthread_cancel_init (in 
/lib/i686/cmov/libpthread-2.7.so)
==32444==by 

Bug#588997: Bug #588997: Further information (run with debug symbols and suppression file additions)

2010-07-14 Thread Pauli Sundberg
The same errors with debug symbols:
sundb...@fs1:~$ valgrind  --error-exitcode=1 --leak-check=full
--show-reachable=yes ./silly
==32537== Memcheck, a memory error detector.
==32537== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==32537== Using LibVEX rev 1854, a library for dynamic binary translation.
==32537== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==32537== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation
framework.
==32537== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==32537== For more details, rerun with: -v
==32537==

In main: creating thread 0
In main: creating thread 1
Hello World! It's me, thread #1!
In main: creating thread 2
Hello World! It's me, thread #2!
In main: creating thread 3
Hello World! It's me, thread #3!
In main: creating thread 4
Hello World! It's me, thread #4!
Hello World! It's me, thread #0!
==32537==
==32537== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 16 from 1)
==32537== malloc/free: in use at exit: 1,588 bytes in 10 blocks.
==32537== malloc/free: 10 allocs, 0 frees, 1,588 bytes allocated.
==32537== For counts of detected errors, rerun with: -v
==32537== searching for pointers to 10 not-freed blocks.
==32537== checked 41,988,668 bytes.
==32537==
==32537== 19 bytes in 1 blocks are still reachable in loss record 1 of 6
==32537==at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==32537==by 0x400A551: _dl_new_object (in /lib/ld-2.7.so)
==32537==by 0x4005FB2: _dl_map_object_from_fd (in /lib/ld-2.7.so)
==32537==by 0x4007E0C: _dl_map_object (in /lib/ld-2.7.so)
==32537==by 0x4011B46: dl_open_worker (in /lib/ld-2.7.so)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x401154D: _dl_open (in /lib/ld-2.7.so)
==32537==by 0x413E8B1: do_dlopen (dl-libc.c:86)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x413E9B0: dlerror_run (dl-libc.c:47)
==32537==by 0x413EAD5: __libc_dlopen_mode (dl-libc.c:160)
==32537==by 0x4035146: pthread_cancel_init (unwind-forcedunwind.c:47)
==32537==
==32537==
==32537== 19 bytes in 1 blocks are still reachable in loss record 2 of 6
==32537==at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==32537==by 0x4004D7E: local_strdup (in /lib/ld-2.7.so)
==32537==by 0x400809B: _dl_map_object (in /lib/ld-2.7.so)
==32537==by 0x4011B46: dl_open_worker (in /lib/ld-2.7.so)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x401154D: _dl_open (in /lib/ld-2.7.so)
==32537==by 0x413E8B1: do_dlopen (dl-libc.c:86)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x413E9B0: dlerror_run (dl-libc.c:47)
==32537==by 0x413EAD5: __libc_dlopen_mode (dl-libc.c:160)
==32537==by 0x4035146: pthread_cancel_init (unwind-forcedunwind.c:47)
==32537==by 0x4035270: _Unwind_ForcedUnwind (unwind-forcedunwind.c:98)
==32537==
==32537==
==32537== 28 bytes in 1 blocks are still reachable in loss record 3 of 6
==32537==at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==32537==by 0x400C355: _dl_map_object_deps (in /lib/ld-2.7.so)
==32537==by 0x4011BA6: dl_open_worker (in /lib/ld-2.7.so)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x401154D: _dl_open (in /lib/ld-2.7.so)
==32537==by 0x413E8B1: do_dlopen (dl-libc.c:86)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x413E9B0: dlerror_run (dl-libc.c:47)
==32537==by 0x413EAD5: __libc_dlopen_mode (dl-libc.c:160)
==32537==by 0x4035146: pthread_cancel_init (unwind-forcedunwind.c:47)
==32537==by 0x4035270: _Unwind_ForcedUnwind (unwind-forcedunwind.c:98)
==32537==by 0x4032E80: __pthread_unwind (unwind.c:130)
==32537==
==32537==
==32537== 224 bytes in 1 blocks are still reachable in loss record 4 of 6
==32537==at 0x4021E22: calloc (vg_replace_malloc.c:397)
==32537==by 0x400F44D: _dl_check_map_versions (in /lib/ld-2.7.so)
==32537==by 0x4011E3E: dl_open_worker (in /lib/ld-2.7.so)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x401154D: _dl_open (in /lib/ld-2.7.so)
==32537==by 0x413E8B1: do_dlopen (dl-libc.c:86)
==32537==by 0x400DA15: _dl_catch_error (in /lib/ld-2.7.so)
==32537==by 0x413E9B0: dlerror_run (dl-libc.c:47)
==32537==by 0x413EAD5: __libc_dlopen_mode (dl-libc.c:160)
==32537==by 0x4035146: pthread_cancel_init (unwind-forcedunwind.c:47)
==32537==by 0x4035270: _Unwind_ForcedUnwind (unwind-forcedunwind.c:98)
==32537==by 0x4032E80: __pthread_unwind (unwind.c:130)
==32537==
==32537==
==32537== 618 bytes in 1 blocks are still reachable in loss record 5 of 6
==32537==at 0x4021E22: calloc (vg_replace_malloc.c:397)
==32537==by 0x400A2EA: _dl_new_object (in /lib/ld-2.7.so)
==32537==by 0x4005FB2: _dl_map_object_from_fd (in /lib/ld-2.7.so)
==32537==by 0x4007E0C: _dl_map_object (in /lib/ld-2.7.so)
==32537==by 0x4011B46: dl_open_worker