|
From: Stefan W. <swi...@gm...> - 2011-08-11 13:56:21
|
I am running a multi-threaded program under Debian. The application creates two threads at the time it is started. Both threads do the same work, the main thread does something different. Everything works fine, but occasionally I will get these lines in my output: ==8280== Thread 3: ==8280== Syscall param read(buf) points to unaddressable byte(s) ==8280== at 0x40ABF5B: ??? (syscall-template.S:82) ==8280== by 0x40A496D: start_thread (pthread_create.c:300) ==8280== by 0x437BA4D: clone (clone.S:130) ==8280== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==8280== This can happen hours or days after the thread was created. It is always thread 2 or 3, never thread 1. In the output, all parameters except the thread number are identical, if the error occurs. Finally, the error seems to have no effect whatsoever on the program itself, it continues running and no other errors occur. My question is, whether this is something I am doing wrong, and if so, where I could start to find out what's going on. From the stacktrace, none of the functions listed there are mine, so I'm wondering where this is actually happening. Stefan |
|
From: John R. <jr...@bi...> - 2011-08-11 15:19:38
|
> ==8280== Thread 3: > ==8280== Syscall param read(buf) points to unaddressable byte(s) > ==8280== at 0x40ABF5B: ??? (syscall-template.S:82) > ==8280== by 0x40A496D: start_thread (pthread_create.c:300) > ==8280== by 0x437BA4D: clone (clone.S:130) > ==8280== Address 0x0 is not stack'd, malloc'd or (recently) free'd > ==8280== Thread creation ultimately involves clone(). "man 2 clone" shows that clone() takes at least 4 and up to 7 parameters. Whether each of the last three parameters actually are present depends on flag bits in the third parameter. The behavior is complex and thinly documented. Each of the last three arguments is an address, and 0 (NULL) often means "ignore this address" even if the corresponding flag bit says "the argument is present". The way to track this down is to use strace to determine the actual arguments to clone(), look through the Linux kernel source code to see what the flag bits really mean for each case, then compare with memcheck's code for clone(). Perhaps the valgrind option "--trace-syscalls=yes" will help, too, although that code might already have problems for clone(). File a bug report. Include the output from strace, the complaint from memcheck, the version numbers of memcheck and the OS, and which hardware architecture. -- |