You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ valgrind bin/x86_64-pc-linux-gnu/roc-test-fec
[...]
---------- before body: ==2972359==
==2972359== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==2972359== General Protection Fault
==2972359== at 0x4905520: _mm_load_ps (xmmintrin.h:974)
==2972359== by 0x4905520: of_add_to_symbol (of_symbol.c:654)
==2972359== by 0x490774D: of_ldpc_staircase_build_repair_symbol (of_ldpc_staircase_api.c:411)
==2972359== by 0x4905BC4: of_build_repair_symbol (of_openfec_api.c:384)
==2972359== by 0x137CB5: roc::fec::OpenfecEncoder::fill() (openfec_encoder.cpp:131)
==2972359== by 0x135CA8: roc::fec::Writer::encode_repair_packets_() (writer.cpp:260)
==2972359== by 0x135F1A: roc::fec::Writer::end_block_() (writer.cpp:158)
==2972359== by 0x136037: roc::fec::Writer::write(roc::core::SharedPtr<roc::packet::Packet, roc::core::RefCountedOwnership> const&) (writer.cpp:128)
==2972359== by 0x12E675: roc::fec::TEST_writer_reader_failed_to_read_repair_packet_Test::testBody() (test_writer_reader.cpp:3171)
==2972359== by 0x1A758F: PlatformSpecificSetJmpImplementation (in /var/tmp/portage/media-libs/roc-toolkit-0.4.0/work/roc-toolkit-0.4.0/bin/x86_64-pc-linux-gnu/roc-test-fec)
==2972359== by 0x1A687B: Utest::run() (in /var/tmp/portage/media-libs/roc-toolkit-0.4.0/work/roc-toolkit-0.4.0/bin/x86_64-pc-linux-gnu/roc-test-fec)
==2972359== by 0x1A605E: UtestShell::runOneTestInCurrentProcess(TestPlugin*, TestResult&) (in /var/tmp/portage/media-libs/roc-toolkit-0.4.0/work/roc-toolkit-0.4.0/bin/x86_64-pc-linux-gnu/roc-test-fec)
==2972359== by 0x1A758F: PlatformSpecificSetJmpImplementation (in /var/tmp/portage/media-libs/roc-toolkit-0.4.0/work/roc-toolkit-0.4.0/bin/x86_64-pc-linux-gnu/roc-test-fec)
==2972359==
Backtrace:
Program received signal SIGSEGV, Segmentation fault.
of_add_to_symbol (to=<optimized out>, from=0x5555556c8ff8, symbol_size=16)
at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_common/linear_binary_codes_utils/of_symbol.c:655
655 a = _mm_xor_ps (a, b);
(gdb) bt
#0 of_add_to_symbol (to=<optimized out>, from=0x5555556c8ff8, symbol_size=16)
at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_common/linear_binary_codes_utils/of_symbol.c:655
#1 of_ldpc_staircase_build_repair_symbol (ofcb=0x5555556daf60, encoding_symbols_tab=0x5555556e7898, esi_of_symbol_to_build=<optimized out>)
at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_stable/ldpc_staircase/of_ldpc_staircase_api.c:411
#2 0x00005555555f4a5a in roc::fec::OpenfecEncoder::fill (this=0x5555556c84e8) at src/internal_modules/roc_fec/target_openfec/roc_fec/openfec_encoder.cpp:131
#3 0x00005555555b0bb9 in roc::fec::Codec::encode (n_source=10, n_repair=20, this=0x7fffffffd7f0, p_size=<optimized out>) at src/tests/roc_fec/test_encoder_decoder.cpp:49
#4 roc::fec::TEST_encoder_decoder_full_repair_payload_sizes_Test::testBody (this=<optimized out>) at src/tests/roc_fec/test_encoder_decoder.cpp:207
#5 0x0000555555696a8f in PlatformSpecificSetJmpImplementation (function=0x5555556f2130, data=0x5555556c8ff8)
at ../../../../dev-util/cpputest-4.0/work/cpputest-4.0/src/Platforms/Gcc/UtestPlatform.cpp:167
#6 0x0000555555697446 in Utest::run (this=0x5555556f2130) at ../../../../dev-util/cpputest-4.0/work/cpputest-4.0/src/CppUTest/Utest.cpp:606
#7 0x00005555556976bf in UtestShell::runOneTestInCurrentProcess (this=0x5555556f2130, plugin=0x5555556c8ff8, result=...)
at ../../../../dev-util/cpputest-4.0/work/cpputest-4.0/src/CppUTest/Utest.cpp:216
#8 0x0000555555696a8f in PlatformSpecificSetJmpImplementation (function=0x5555556f2130, data=0x5555556c8ff8)
at ../../../../dev-util/cpputest-4.0/work/cpputest-4.0/src/Platforms/Gcc/UtestPlatform.cpp:167
#9 0x00005555555fb64c in main (argc=<optimized out>, argv=<optimized out>) at ../../../../dev-util/cpputest-4.0/work/cpputest-4.0/src/CppUTest/Utest.cpp:185
I was confused as the address there seems aligned but I actually think gdb was showing the wrong rough line now, as it didn't consistently show that specific intrinsic.
After building openfec with UBSAN (-fsanitize=undefined), I got a bunch of failures in openfec's own testsuite like:
encoding_end=1729245940.458667 encoding_time=0.345245
decoding_start=1729245940.458683
/var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8.c:394:3: runtime error: load of misaligned address 0x5761b223920c for type 'long long unsigned int', which requires 8 byte alignment
0x5761b223920c: note: pointer points here
99 76 12 e1 c8 4e 24 d6 14 5b 28 cb bf d7 3f 0b c7 ce 09 0d 22 8f 06 18 7d 48 a7 da 0d c3 cb ad
^
#0 0x7e54dd5d4e1f in of_addmul1 /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8.c:394
#1 0x7e54dd5d7b61 in of_invert_mat /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8.c:631
#2 0x7e54dd5d8880 in of_build_decode_matrix /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8.c:1004
#3 0x7e54dd5da010 in of_rs_decode /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8.c:1056
#4 0x7e54dd5dc191 in of_rs_finish_decoding /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8_api.c:383
#5 0x7e54dd5dc8f1 in of_rs_decode_with_new_symbol /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_stable/reed-solomon_gf_2_8/of_reed-solomon_gf_2_8_api.c:234
#6 0x7e54dd5cc879 in of_decode_with_new_symbol /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/src/lib_common/of_openfec_api.c:442
#7 0x57619c8054e3 in receive_and_decode /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/applis/eperftool/receiver.c:156
#8 0x57619c8049bc in start_enc_dec_test /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/applis/eperftool/eperftool.c:268
#9 0x57619c804d6f in main /var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/applis/eperftool/eperftool.c:71
#10 0x7e54dcc03746 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#11 0x7e54dcc037f6 in __libc_start_main_impl ../csu/libc-start.c:360
#12 0x57619c800dc0 in _start (/var/tmp/portage/media-libs/openfec-1.4.2.11/work/openfec-1.4.2.11/bin/RelWithDebInfo/eperftool+0x5dc0)
But if I persevere and try roc-toolkit again with an UBSAN-instrumented openfec, I get:
$ gdb --args bin/x86_64-pc-linux-gnu/roc-test-fec
[...]
./usr/lib/gcc/x86_64-pc-linux-gnu/15/include/xmmintrin.h:974:10: runtime error: load of misaligned address 0x5555556b0718 for type '__m128', which requires 16 byte alignment
0x5555556b0718: note: pointer points here
00 00 00 00 80 0a 00 00 00 00 00 00 00 00 02 2b 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
^
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ee4865 in _mm_xor_ps (__A=..., __B=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/xmmintrin.h:285
285 return __builtin_ia32_xorps (__A, __B);
(gdb) bt
#0 0x00007ffff7ee4865 in _mm_xor_ps (__A=..., __B=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/xmmintrin.h:285
#1 of_add_to_symbol (to=to@entry=0x5555556af190, from=from@entry=0x5555556b0718, symbol_size=<optimized out>)
at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_common/linear_binary_codes_utils/of_symbol.c:655
#2 0x00007ffff7eeaa26 in of_ldpc_staircase_build_repair_symbol (ofcb=ofcb@entry=0x5555556b1670, encoding_symbols_tab=encoding_symbols_tab@entry=0x5555556b0ee8,
esi_of_symbol_to_build=esi_of_symbol_to_build@entry=20) at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_stable/ldpc_staircase/of_ldpc_staircase_api.c:411
#3 0x00007ffff7ee547f in of_build_repair_symbol (ses=0x5555556b1670, encoding_symbols_tab=0x5555556b0ee8, esi_of_symbol_to_build=20)
at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_common/of_openfec_api.c:384
#4 0x0000555555583cb6 in roc::fec::OpenfecEncoder::fill (this=0x5555556a6e08) at src/internal_modules/roc_fec/target_openfec/roc_fec/openfec_encoder.cpp:130
#5 0x0000555555581ca9 in roc::fec::Writer::encode_repair_packets_ (this=this@entry=0x7fffffffd680) at src/internal_modules/roc_fec/writer.cpp:260
#6 0x0000555555581f1b in roc::fec::Writer::end_block_ (this=this@entry=0x7fffffffd680) at src/internal_modules/roc_fec/writer.cpp:158
#7 0x0000555555582038 in roc::fec::Writer::write (this=this@entry=0x7fffffffd680, pp=...) at src/internal_modules/roc_fec/writer.cpp:128
#8 0x000055555557a676 in roc::fec::TEST_writer_reader_failed_to_read_repair_packet_Test::testBody (this=<optimized out>) at src/tests/roc_fec/test_writer_reader.cpp:3171
#9 0x00005555555f3590 in PlatformSpecificSetJmpImplementation ()
#10 0x00005555555f287c in Utest::run() ()
#11 0x00005555555f205f in UtestShell::runOneTestInCurrentProcess(TestPlugin*, TestResult&) ()
#12 0x00005555555f3590 in PlatformSpecificSetJmpImplementation ()
#13 0x00005555555efbf9 in UtestShell::runOneTest(TestPlugin*, TestResult&) ()
#14 0x00005555555ef34c in TestRegistry::runAllTests(TestResult&) ()
#15 0x00005555555e065c in CommandLineTestRunner::runAllTests() ()
#16 0x00005555555e07e1 in CommandLineTestRunner::runAllTestsMain() ()
#17 0x00005555555e096a in CommandLineTestRunner::RunAllTests(int, char const* const*) ()
#18 0x000055555557f00a in main (argc=1, argv=0x7fffffffe278) at src/tests/test_main.cpp:56
(gdb) frame 1
#1 of_add_to_symbol (to=to@entry=0x5555556af190, from=from@entry=0x5555556b0718, symbol_size=<optimized out>)
at /usr/src/debug/media-libs/openfec-1.4.2.11/openfec-1.4.2.11/src/lib_common/linear_binary_codes_utils/of_symbol.c:655
655 a = _mm_xor_ps (a, b);
(gdb) p a
$1 = {0, 0, 0, 0}
(gdb) p b
$2 = {3.76669027e-42, 0, 4.61852778e-13, 3.82047143e-37}
(gdb) p &a
$3 = (__m128 *) 0x7fffffffd400
(gdb) p &b
$4 = (__m128 *) 0x5555556b0718
The text was updated successfully, but these errors were encountered:
thesamesam
changed the title
SSE assembly has unaligned accesses
SSE assembly has unaligned accesses (-DASSEMBLY_SSE_OPT=ON)
Oct 18, 2024
We had a report downstream in Gentoo at https://bugs.gentoo.org/941750 of roc-toolkit's tests segfaulting.
The backtrace on the roc-toolkit side is:
Backtrace:
I was confused as the address there seems aligned but I actually think gdb was showing the wrong rough line now, as it didn't consistently show that specific intrinsic.
After building openfec with UBSAN (
-fsanitize=undefined
), I got a bunch of failures in openfec's own testsuite like:But if I persevere and try roc-toolkit again with an UBSAN-instrumented openfec, I get:
The text was updated successfully, but these errors were encountered: