https://bugs.kde.org/show_bug.cgi?id=445032
Bug ID: 445032 Summary: valgrind/memcheck crash with SIGSEGV when SIGVTALRM timer used and libthr.so associated Product: valgrind Version: unspecified Platform: FreeBSD Ports OS: FreeBSD Status: REPORTED Severity: crash Priority: NOR Component: memcheck Assignee: jsew...@acm.org Reporter: afraid-splicer...@icloud.com Target Milestone: --- Created attachment 143251 --> https://bugs.kde.org/attachment.cgi?id=143251&action=edit C test case for valgrind segmentation fault SUMMARY A program which uses an interval timer (e.g., ITIMER_VIRTUAL w/ SIGVTALRM handler), linked with libthr.so, will take a SIGSEGV when run under valgrind STEPS TO REPRODUCE 1. Compile provided sample, vgtest.c -- cc is FreeBSD clang version 11.0.1 cc -pthread /var/tmp/vgtest.c -o /var/tmp/vgtest 2. Run it under valgrind valgrind /var/tmp/vgtest 3. Compiling the same test case without -pthread option runs without error. OBSERVED RESULT $ ldd /var/tmp/vgtest /var/tmp/vgtest: libthr.so.3 => /lib/libthr.so.3 (0x20442000) libc.so.7 => /lib/libc.so.7 (0x2046b000) $ valgrind /var/tmp/vgtest ==28547== Memcheck, a memory error detector ==28547== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==28547== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info ==28547== Command: /var/tmp/vgtest ==28547== ==28547== Invalid read of size 4 ==28547== at 0x71FFB9B: ??? (in /lib/libthr.so.3) ==28547== by 0x71FF16F: ??? (in /lib/libthr.so.3) ==28547== by 0x3819FB73: ??? (in /usr/local/libexec/valgrind/memcheck-x86-freebsd) ==28547== by 0x72B973E: sleep (in /lib/libc.so.7) ==28547== by 0x4018F2: main (in /var/tmp/vgtest) ==28547== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==28547== ==28547== ==28547== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==28547== Access not within mapped region at address 0x0 ==28547== at 0x71FFB9B: ??? (in /lib/libthr.so.3) ==28547== by 0x71FF16F: ??? (in /lib/libthr.so.3) ==28547== by 0x3819FB73: ??? (in /usr/local/libexec/valgrind/memcheck-x86-freebsd) ==28547== by 0x72B973E: sleep (in /lib/libc.so.7) ==28547== by 0x4018F2: main (in /var/tmp/vgtest) ==28547== If you believe this happened as a result of a stack ==28547== overflow in your program's main thread (unlikely but ==28547== possible), you can try to increase the size of the ==28547== main thread stack using the --main-stacksize= flag. ==28547== The main thread stack size used in this run was 16777216. ==28547== ==28547== HEAP SUMMARY: ==28547== in use at exit: 724 bytes in 2 blocks ==28547== total heap usage: 2 allocs, 0 frees, 724 bytes allocated ==28547== ==28547== LEAK SUMMARY: ==28547== definitely lost: 0 bytes in 0 blocks ==28547== indirectly lost: 0 bytes in 0 blocks ==28547== possibly lost: 0 bytes in 0 blocks ==28547== still reachable: 724 bytes in 2 blocks ==28547== suppressed: 0 bytes in 0 blocks ==28547== Rerun with --leak-check=full to see details of leaked memory ==28547== ==28547== For lists of detected and suppressed errors, rerun with: -s ==28547== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 1 from 1) Segmentation fault $ EXPECTED RESULT $ valgrind /var/tmp/vgtest ==28579== Memcheck, a memory error detector ==28579== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==28579== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info ==28579== Command: /var/tmp/vgtest ==28579== ==28579== ==28579== HEAP SUMMARY: ==28579== in use at exit: 0 bytes in 0 blocks ==28579== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==28579== ==28579== All heap blocks were freed -- no leaks are possible ==28579== ==28579== For lists of detected and suppressed errors, rerun with: -s ==28579== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1 from 1) SOFTWARE/OS VERSIONS $ uname -a FreeBSD flap.gateway.sonic.net 13.0-RELEASE-p4 FreeBSD 13.0-RELEASE-p4 #0: Tue Aug 24 18:58:48 UTC 2021 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/i386.i386/sys/GENERIC i386 $ valgrind --version valgrind-3.18.1 (also occurs with valgrind compiled from the latest git sources, commit 3950c5d661ee09526cddcf24daf5fc22bc83f70c) ADDITIONAL INFORMATION Your software version fields could do with an update -- most recent listed is 3.15 but valgrind is at 3.18.1 released, and 3.19.0 in git. Might be related to https://github.com/paulfloyd/freebsd_valgrind/issues/137 -- You are receiving this mail because: You are watching all bug changes.