Memory problems on pthread_cancel()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Ubuntu) |
Won't Fix
|
High
|
Unassigned |
Bug Description
$ cat ops.c
#include <unistd.h>
#include <pthread.h>
void *func(void *nop)
{
sleep(100);
return NULL;
}
int main(int argc, char *argv[])
{
void *ptr;
pthread_t id;
pthread_
pthread_
pthread_
return 0;
}
$ cc ops.c -o ops -lpthread -ggdb -Wall
$ valgrind ./ops
==23044== Memcheck, a memory error detector.
==23044== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==23044== Using LibVEX rev 1471, a library for dynamic binary translation.
==23044== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==23044== Using valgrind-
==23044== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==23044== For more details, rerun with: -v
==23044==
==23044== Invalid read of size 8
==23044== at 0x4010664: (within /lib/ld-2.3.6.so)
==23044== by 0x40089BC: (within /lib/ld-2.3.6.so)
==23044== by 0x4004DF3: (within /lib/ld-2.3.6.so)
==23044== by 0x4006612: (within /lib/ld-2.3.6.so)
==23044== by 0x4D2C51B: (within /lib/libc-2.3.6.so)
==23044== by 0x400B13F: (within /lib/ld-2.3.6.so)
==23044== by 0x4D2D0C9: _dl_open (in /lib/libc-2.3.6.so)
==23044== by 0x4D2E627: (within /lib/libc-2.3.6.so)
==23044== by 0x400B13F: (within /lib/ld-2.3.6.so)
==23044== by 0x4D2E6D2: __libc_dlopen_mode (in /lib/libc-2.3.6.so)
==23044== by 0x4B2ABCB: pthread_cancel_init (in /lib/libpthread
==23044== by 0x4B27867: pthread_cancel (in /lib/libpthread
==23044== Address 0x566D0F8 is 16 bytes inside a block of size 19 alloc'd
==23044== at 0x4A19A16: malloc (vg_replace_
==23044== by 0x4006A00: (within /lib/ld-2.3.6.so)
==23044== by 0x4D2C51B: (within /lib/libc-2.3.6.so)
==23044== by 0x400B13F: (within /lib/ld-2.3.6.so)
==23044== by 0x4D2D0C9: _dl_open (in /lib/libc-2.3.6.so)
==23044== by 0x4D2E627: (within /lib/libc-2.3.6.so)
==23044== by 0x400B13F: (within /lib/ld-2.3.6.so)
==23044== by 0x4D2E6D2: __libc_dlopen_mode (in /lib/libc-2.3.6.so)
==23044== by 0x4B2ABCB: pthread_cancel_init (in /lib/libpthread
==23044== by 0x4B27867: pthread_cancel (in /lib/libpthread
==23044== by 0x400624: main (ops.c:15)
==23044==
==23044== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from 1)
==23044== malloc/free: in use at exit: 1,604 bytes in 6 blocks.
==23044== malloc/free: 6 allocs, 0 frees, 1,604 bytes allocated.
==23044== For counts of detected errors, rerun with: -v
==23044== searching for pointers to 6 not-freed blocks.
==23044== checked 8,567,792 bytes.
==23044==
==23044== LEAK SUMMARY:
==23044== definitely lost: 0 bytes in 0 blocks.
==23044== possibly lost: 136 bytes in 1 blocks.
==23044== still reachable: 1,468 bytes in 5 blocks.
==23044== suppressed: 0 bytes in 0 blocks.
==23044== Reachable blocks (those to which a pointer was found) are not shown.
==23044== To see them, rerun with: --show-
$ uname -a
Linux ub2006 2.6.15-
$ ls -al /lib/ld-
lrwxrwxrwx 1 root root 11 2006-06-02 12:51 /lib/ld-
Changed in glibc: | |
status: | Confirmed → Triaged |
==3641== Memcheck, a memory error detector. 3.2.1-Debian, a dynamic binary instrumentation framework. e=1162325252 or greater e=1162324600 or greater e=1162324648 or greater eventmanager (in /usr/lib/ libpthread. so.20.0. 27) i686/cmov/ libc-2. 5.so) malloc. c:149) libpthread. so.20.0. 27) libpthread. so.20.0. 27) libpthread. so.20.0. 27) i686/cmov/ libc-2. 5.so) malloc. c:149) libpthread. so.20.0. 27) libpthread. so.20.0. 27) libpthread. so.20.0. 27) i686/cmov/ libc-2. 5.so) malloc. c:149) libpthread. so.20.0. 27) libpthread. so.20.0. 27) libpthread. so.20.0. 27) i686/cmov/ libc-2. 5.so) malloc. c:149) libpthread. so.20.0. 27) libpthread. so.20.0. 27) libpthread. so.20.. ..
==3641== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==3641== Using LibVEX rev 1658, a library for dynamic binary translation.
==3641== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==3641== Using valgrind-
==3641== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==3641== For more details, rerun with: -v
==3641==
==3641== Warning: client switching stacks? SP change: 0xBED226BC --> 0x419D3C0
==3641== to suppress, use: --max-stackfram
==3641== Warning: client switching stacks? SP change: 0x419D134 --> 0xBED226BC
==3641== to suppress, use: --max-stackfram
==3641== Warning: client switching stacks? SP change: 0xBED2268C --> 0x419D134
==3641== to suppress, use: --max-stackfram
==3641== further instances of this message will not be shown.
==3641== Conditional jump or move depends on uninitialised value(s)
==3641== at 0x403C4A6: __pth_sched_
==3641==
==3641== Invalid read of size 4
==3641== at 0x4083566: swapcontext (in /lib/tls/
==3641== Address 0x419D834 is 260 bytes inside a block of size 768 alloc'd
==3641== at 0x4021620: malloc (vg_replace_
==3641== by 0x403C1E7: __pth_tcb_alloc (in /usr/lib/
==3641== by 0x403E80D: pth_spawn (in /usr/lib/
==3641== by 0x403AE25: pthread_create (in /usr/lib/
==3641== by 0x80485AC: main (pth-bug.c:16)
==3641==
==3641== Invalid read of size 4
==3641== at 0x4083569: swapcontext (in /lib/tls/
==3641== Address 0x419D838 is 264 bytes inside a block of size 768 alloc'd
==3641== at 0x4021620: malloc (vg_replace_
==3641== by 0x403C1E7: __pth_tcb_alloc (in /usr/lib/
==3641== by 0x403E80D: pth_spawn (in /usr/lib/
==3641== by 0x403AE25: pthread_create (in /usr/lib/
==3641== by 0x80485AC: main (pth-bug.c:16)
==3641==
==3641== Invalid read of size 4
==3641== at 0x408356C: swapcontext (in /lib/tls/
==3641== Address 0x419D83C is 268 bytes inside a block of size 768 alloc'd
==3641== at 0x4021620: malloc (vg_replace_
==3641== by 0x403C1E7: __pth_tcb_alloc (in /usr/lib/
==3641== by 0x403E80D: pth_spawn (in /usr/lib/
==3641== by 0x403AE25: pthread_create (in /usr/lib/
==3641== by 0x80485AC: main (pth-bug.c:16)
==3641==
==3641== Invalid read of size 4
==3641== at 0x408356F: swapcontext (in /lib/tls/
==3641== Address 0x419D844 is 276 bytes inside a block of size 768 alloc'd
==3641== at 0x4021620: malloc (vg_replace_
==3641== by 0x403C1E7: __pth_tcb_alloc (in /usr/lib/
==3641== by 0x403E80D: pth_spawn (in /usr/lib/
==3641== by 0x403AE25: pthread_create (in /usr/lib/