• Kirill Smelkov's avatar
    golang: tests: Fix TSAN/ASAN wrt Debian testing · 49bb8dcd
    Kirill Smelkov authored
    Current Debian testing builds libtsan/libasan with --as-needed, which
    leads to libstdc++.so not being linked in. Compare Debian 10:
    
        kirr@link:~/src/tools/go/pygolang$ ldd /usr/lib/x86_64-linux-gnu/libasan.so.5
            linux-vdso.so.1 (0x00007ffe7e97f000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f00ad9d5000)
            librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f00ad9cb000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f00ad9aa000)
            libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f00ad7d2000)		<-- libstdc++
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f00ad64f000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f00ad48e000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f00ad472000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f00ae7c8000)
    
    to Debian testing:
    
        kirr@deco:~/src/tools/go/pygolang$ ldd /usr/lib/x86_64-linux-gnu/libasan.so.6
            linux-vdso.so.1 (0x00007ffe15d0b000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f53ba069000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f53ba047000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f53b9f03000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f53b9d3e000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f53b9d24000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f53baa6b000)
    
    where libstdc++ is not being linked to libasan.so
    
    This leads to the following crash:
    
        golang/golang_test.py::test_pyx_select_inplace ==181237==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/asan/asan_interceptors.cpp:333 "((__interception::real___cxa_throw)) != (0)" (0x0, 0x0)
            #0 0x7f76aa9f4657  (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xb2657)
            #1 0x7f76aaa11d5a  (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xcfd5a)
            #2 0x7f76aa97ac14 in __cxa_throw (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x38c14)
            #3 0x7f76a497a9ef in panic golang/runtime/libgolang.cpp:79
            #4 0x7f76a497e9a9 in _chanselect golang/runtime/libgolang.cpp:956
            #5 0x7f76a455573c in select<1> golang/libgolang.h:535
            #6 0x7f76a454fa4b in _test_select_inplace() golang/runtime/libgolang_test.cpp:417
            #7 0x7f76a452781e in __pyx_pf_6golang_12_golang_test_30test_select_inplace golang/_golang_test.cpp:4859
            #8 0x7f76a45277db in __pyx_pw_6golang_12_golang_test_31test_select_inplace golang/_golang_test.cpp:4821
    
    explained by https://github.com/google/sanitizers/issues/934
    
    -> work it around by manually preloading libstdc++ as well.
    49bb8dcd
trun 7.04 KB