Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#73835 - Immediate segmentation fault when programs is compiled with GCC and thread sanitizer

Attached to Project: Arch Linux
Opened by Daniel (utsi) - Thursday, 17 February 2022, 14:00 GMT
Last edited by freswa (frederik) - Saturday, 14 May 2022, 14:20 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Giancarlo Razzolini (grazzolini)
freswa (frederik)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description:
Enabling thread sanitizer (-fsanitize=thread) using G++ on a minimal program causes the resulting program to immediately segfault. This worked fine before using GCC 11.1.0-3.
Clang compiler however still works.

Additional info:
* GCC 11.2.0-3

Steps to reproduce:

1. Create minimal C++ program (e.g. main.cpp)
int main(){}
2. Compile using thread sanitizer
g++ main.cpp -fsanitize=thread -o main
3. Run executable
./main

The result should be a segfault.




Running with gdb and getting a backtrack produces the following:
(gdb) start
Temporary breakpoint 1 at 0x113d
Starting program: /tmp/main
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff74c06a0 in __tsan::TraceAddEvent (addr=0, typ=__tsan::EventTypeMop, fs=..., thr=0x7ffff6ea37c0) at /usr/src/debug/gcc/libsanitizer/tsan/tsan_rtl.h:872
872 /usr/src/debug/gcc/libsanitizer/tsan/tsan_rtl.h: No such file or directory.
(gdb) bt
#0 0x00007ffff74c06a0 in __tsan::TraceAddEvent (addr=0, typ=__tsan::EventTypeMop, fs=..., thr=0x7ffff6ea37c0) at /usr/src/debug/gcc/libsanitizer/tsan/tsan_rtl.h:872
#1 __tsan::Release (thr=thr@entry=0x7ffff6ea37c0, pc=<optimized out>, addr=addr@entry=140737345174768) at /usr/src/debug/gcc/libsanitizer/tsan/tsan_rtl_mutex.cpp:453
#2 0x00007ffff744e003 in __cxa_guard_release (g=0x7ffff7773cf0 <guard variable for __sanitizer::GetAltStackSize()::kAltStackSize>)
at /usr/src/debug/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:882
#3 0x00007ffff74d7e4f in __sanitizer::GetAltStackSize () at /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp:170
#4 0x00007ffff74d8515 in __sanitizer::SetAlternateSignalStack () at /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp:183
#5 __sanitizer::SetAlternateSignalStack () at /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp:174
#6 0x00007ffff74d8715 in __sanitizer::InstallDeadlySignalHandlers (handler=handler@entry=0x7ffff74b2c70 <__tsan::TsanOnDeadlySignal(int, void*, void*)>)
at /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp:217
#7 0x00007ffff74b45bb in __tsan::Initialize (thr=0x7ffff6ea37c0) at /usr/src/debug/gcc/libsanitizer/tsan/tsan_rtl.cpp:395
#8 0x00007ffff7fcc01e in _dl_init () from /lib64/ld-linux-x86-64.so.2
#9 0x00007ffff7fe396a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#10 0x0000000000000001 in ?? ()
#11 0x00007fffffffe52a in ?? ()
#12 0x0000000000000000 in ?? ()
This task depends upon

Closed by  freswa (frederik)
Saturday, 14 May 2022, 14:20 GMT
Reason for closing:  Fixed
Additional comments about closing:  bug is no longer present in GCC 12.1.0-1

Loading...