From: <edw...@gm...> - 2006-09-22 18:50:52
|
Hi, It would be cool if valgrind could detect incorrect use of longjmp/setjmp in multithreaded programs. Such as using setjmp in one thread, and doing longjmp to that address from another thread. Or: doing setjmp in a global variable, and doing longjmp on that (having quite a good chance to have that variable overwritten by another thread by the time you do the longjmp). Valgrind already detects that the client is 'switching stacks', could it also say the exact reason, such as: caused by use of longjmp in file:line. Could it also check if you switching stacks, and using the stack of another thread? FYI, libcurl does siglongjmp using a global variable, and in a multithreaded environment it just segfaults, because it jumps to another thread, where the pointers to its buffers are invalid. Valgrind currently outputs this: ==2835== Warning: client switching stacks? SP change: 0xBEB0FD2C --> 0xD0678F0 ==2835== to suppress, use: --max-stackframe=1314225092 or greater ==2835== Invalid write of size 4 ==2835== at 0x40F67BD: Curl_resolv (in /usr/lib/libcurl.so.3.0.0) ==2835== Address 0xD0678F4 is on thread 1's stack ==2835== Can't extend stack to 0xD067390 during signal delivery for thread 1: ==2835== no stack segment ==2835== ==2835== Process terminating with default action of signal 11 (SIGSEGV) ==2835== Access not within mapped region at address 0xD067390 ==2835== at 0x40F67BD: Curl_resolv (in /usr/lib/libcurl.so.3.0.0) Best regards, Edwin |