Created attachment 105586 [details] Transcript valgrind --tool=lackey (and other tools) segfaults immediately.
Created attachment 105587 [details] OS X Problem Report details
valgrind itself segfaults when I run it with my program as argument. This also happens with --tool=lackey. valgrind successfully runs when passed "ls", so it is not completely broken. svn log says: r16385 | iraisr | 2017-05-16 10:54:31 +0200 (Tue, 16 May 2017) | 2 lines Built valgrind today, with: -bash$ cc --version Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.5.0 Thread model: posix
The behavior is similar with todays valgrind (built with Xcode 8.3.3): -bash$ svn log | head -10 ------------------------------------------------------------------------ r16450 | mjw | 2017-06-16 11:33:35 +0200 (Fri, 16 Jun 2017) | 7 lines
Thanks. We've seen other crashing errors with Valgrind's handling of pthread's on macOS (e.g. bz#380269 and bz#349128). As they may potentially be related, could you try the patch posted there with your program?
I am unsure exactly which patch to apply, and to which version of valgrind. Is there a git branch I could try instead? Also, I am now using macOS 10.13.6, so it is more interesting for me whether it works there. I have access to older macOS VMs, though, if necessary.
I did try valgrind --tool=lackey myprogram with todays git (2b0aa0a5b88f900e986a3360952fcb3d2513419d) on macOS 10.13.6 and it crashes with: ==73034== Process terminating with default action of signal 11 (SIGSEGV) ==73034== Access not within mapped region at address 0x18 ==73034== at 0x10195D5BA: _pthread_body (in /usr/lib/system/libsystem_pthread.dylib) ==73034== by 0x10195D50C: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib) ==73034== by 0x10195CBF8: thread_start (in /usr/lib/system/libsystem_pthread.dylib) But this is not with any extra patches.
*** Bug 396367 has been marked as a duplicate of this bug. ***
*** Bug 399504 has been marked as a duplicate of this bug. ***
Trying to run jemalloc's tests under valgrind on OSX I think I'm running into this issue: The output is: running 1 test test background_threads_runtime_defaults ... ==35051== Thread 2: ==35051== Invalid read of size 4 ==35051== at 0x100A145BA: _pthread_body (in /usr/lib/system/libsystem_pthread.dylib) ==35051== by 0x100A1450C: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib) ==35051== by 0x100A13BF8: thread_start (in /usr/lib/system/libsystem_pthread.dylib) ==35051== Address 0x18 is not stack'd, malloc'd or (recently) free'd ==35051== ==35051== Invalid read of size 8 ==35051== at 0x1005D1FC8: tlv_get_addr (in /usr/lib/system/libdyld.dylib) ==35051== by 0x258056FBD: ??? ==35051== by 0x100A1450C: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib) ==35051== by 0x100A13BF8: thread_start (in /usr/lib/system/libsystem_pthread.dylib) ==35051== Address 0x808 is not stack'd, malloc'd or (recently) free'd ==35051== ==35051== ==35051== Process terminating with default action of signal 11 (SIGSEGV) ==35051== Access not within mapped region at address 0x808 ==35051== at 0x1005D1FC8: tlv_get_addr (in /usr/lib/system/libdyld.dylib) ==35051== by 0x258056FBD: ??? ==35051== by 0x100A1450C: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib) ==35051== by 0x100A13BF8: thread_start (in /usr/lib/system/libsystem_pthread.dylib) ==35051== If you believe this happened as a result of a stack ==35051== overflow in your program's main thread (unlikely but ==35051== possible), you can try to increase the size of the ==35051== main thread stack using the --main-stacksize= flag. ==35051== The main thread stack size used in this run was 8388608. --35051:0:schedule VG_(sema_down): read returned -4 ==35051== ==35051== HEAP SUMMARY: ==35051== in use at exit: 18,912 bytes in 168 blocks ==35051== total heap usage: 189 allocs, 21 frees, 27,360 bytes allocated ==35051== ==35051== LEAK SUMMARY: ==35051== definitely lost: 0 bytes in 0 blocks ==35051== indirectly lost: 0 bytes in 0 blocks ==35051== possibly lost: 72 bytes in 3 blocks ==35051== still reachable: 408 bytes in 8 blocks ==35051== suppressed: 18,432 bytes in 157 blocks ==35051== Rerun with --leak-check=full to see details of leaked memory ==35051== ==35051== For counts of detected and suppressed errors, rerun with: -v ==35051== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 1 from 1) error: process didn't exit successfully: `valgrind /Users/travis/build/gnzlbg/jemallocator/target/x86_64-apple-darwin/debug/deps/background_thread_defaults-e59065218f44f2e7` (signal: 11, SIGSEGV: invalid memory reference)