Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFI_AEAD_Test::ffi_test test failure #4491

Open
thesamesam opened this issue Dec 22, 2024 · 3 comments
Open

FFI_AEAD_Test::ffi_test test failure #4491

thesamesam opened this issue Dec 22, 2024 · 3 comments

Comments

@thesamesam
Copy link

On one machine with botan-3.6.1, I see the following test failure:

[...]
cSHAKE without a name ran 6 tests all ok
cSHAKE-128 ran 81 tests in 0.08 msec all ok
cSHAKE-256 ran 81 tests in 0.06 msec all ok
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/span:375: constexpr std::span<_Type, 18446744073709551615> std::span<_Type, _Extent>::first(size_type) const [with _Type = unsigned char; long unsigned int _Extent = 18446744073709551615; size_type = long unsigned int]: Assertion '__count <= size()' failed.
/var/tmp/portage/dev-libs/botan-3.6.1/temp/environment: line 1404:    45 Aborted                 (core dumped) "$@"
 * ERROR: dev-libs/botan-3.6.1::gentoo failed (test phase):
 *   Failed to run command: ./botan-test3 --test-threads=4

Backtrace:

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at pthread_kill.c:44
#1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:89
#3  0x00007fe8ec62e4c6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007fe8ec610bfa in __GI_abort () at abort.c:79
#5  0x00007fe8ec80a20c in std::__glibcxx_assert_fail (file=file@entry=0x55e848263848 "/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/span", line=line@entry=375, function=function@entry=0x55e8482815f0 "constexpr std::span<_Type, 18446744073709551615> std::span<_Type, _Extent>::first(size_type) const [with _Type = unsigned char; long unsigned int _Extent = 18446744073709551615; size_type = long unsig"..., condition=condition@entry=0x55e84825058a "__count <= size()") at /usr/src/debug/sys-devel/gcc-15.0.9999/gcc-15.0.9999/libstdc++-v3/src/c++11/assert_fail.cc:41
#6  0x000055e847ec414c in std::span<unsigned char, 18446744073709551615ul>::first(unsigned long) const [clone .part.0] [clone .lto_priv.0] (__count=<optimized out>, this=<optimized out>, this=<optimized out>, __count=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/span:375
#7  0x000055e847ebf8e9 in std::span<unsigned char, 18446744073709551615ul>::first (this=<optimized out>, __count=<optimized out>, this=<optimized out>, __count=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/basic_string.h:817
#8  Botan_Tests::(anonymous namespace)::FFI_AEAD_Test::ffi_test (this=<optimized out>, merged_result=..., rng=<optimized out>) at src/tests/test_ffi.cpp:1408
#9  0x000055e848005abe in Botan_Tests::(anonymous namespace)::FFI_Test::run (this=0x7fe8dc0103d0) at src/tests/test_ffi.cpp:68
#10 0x000055e847f6b2fd in Botan_Tests::(anonymous namespace)::run_a_test (test_name="ffi_aead") at src/tests/runner/test_runner.cpp:118
#11 0x000055e847f72d80 in operator() (__closure=0x55e86124a588, test_name="ffi_aead") at src/tests/runner/test_runner.cpp:166
#12 std::__invoke_impl<std::vector<Botan_Tests::Test::Result>, Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> (__f=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:63
#13 std::__invoke<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> (__fn=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:99
#14 std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>::__call<std::vector<Botan_Tests::Test::Result>, 0> (this=0x55e86124a588, __args=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/functional:517
#15 std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>::operator()<> (this=0x55e86124a588) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/functional:602
#16 std::__invoke_impl<std::vector<Botan_Tests::Test::Result>, std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char>)>&> (__f=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:63
#17 std::__invoke_r<std::vector<Botan_Tests::Test::Result>, std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char>)>&> (__fn=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:118
#18 operator() (__closure=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/future:1501
#19 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<std::vector<Botan_Tests::Test::Result, std::allocator<Botan_Tests::Test::Result> > >, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char>)>, std::allocator<int>, std::vector<Botan_Tests::Test::Result>()>::_M_run()::<lambda()>, std::vector<Botan_Tests::Test::Result, std::allocator<Botan_Tests::Test::Result> > >::operator() (this=0x7fe8ec5c2da0) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/future:1418
#20 std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<std::vector<Botan_Tests::Test::Result> >, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<std::vector<Botan_Tests::Test::Result> >, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char>)>, std::allocator<int>, std::vector<Botan_Tests::Test::Result>()>::_M_run()::<lambda()>, std::vector<Botan_Tests::Test::Result> >&> (__f=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:63
#21 std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<std::vector<Botan_Tests::Test::Result> >, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char>)>, std::allocator<int>, std::vector<Botan_Tests::Test::Result>()>::_M_run()::<lambda()>, std::vector<Botan_Tests::Test::Result> >&> (__fn=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:116
#22 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>(), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<std::vector<Botan_Tests::Test::Result, std::allocator<Botan_Tests::Test::Result> > >, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char>)>, std::allocator<int>, std::vector<Botan_Tests::Test::Result>()>::_M_run()::<lambda()>, std::vector<Botan_Tests::Test::Result, std::allocator<Botan_Tests::Test::Result> > > >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:293
#23 0x000055e847f64a54 in std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>::operator() (this=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:593
#24 std::__future_base::_State_baseV2::_M_do_set (this=0x55e86124a560, __f=<optimized out>, __did_set=0x7fe8ec5c2d4f) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/future:598
#25 0x00007fe8ec691044 in __pthread_once_slow (once_control=0x55e86124a578, init_routine=0x7fe8ec855380 <std::__once_proxy()>) at pthread_once.c:116
#26 0x00007fe8ec6910c9 in ___pthread_once (once_control=<optimized out>, init_routine=<optimized out>) at pthread_once.c:143
#27 0x000055e847f6e888 in __gthread_once (__once=<optimized out>, __func=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/x86_64-pc-linux-gnu/bits/gthr-default.h:746
#28 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>*, bool*> (__once=..., __f=@0x7fe8ec5c2d70: (void (std::__future_base::_State_baseV2::*)(class std::__future_base::_State_baseV2 * const, class std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x55e847f64a30 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/mutex:918
#29 std::__future_base::_State_baseV2::_M_set_result (__ignore_failure=false, this=<optimized out>, __res=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/future:437
#30 std::__future_base::_Task_state<std::_Bind<Botan_Tests::Test_Runner::run_tests_multithreaded(const std::vector<std::__cxx11::basic_string<char> >&, size_t)::<lambda(const std::string&)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>, std::allocator<int>, std::vector<Botan_Tests::Test::Result, std::allocator<Botan_Tests::Test::Result> >()>::_M_run(void) (this=0x55e86124a560) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/future:1503
#31 0x00007fe8ecfa4cc7 in std::function<void()>::operator() (this=0x7fe8ec5c2df0) at /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:593
#32 Botan::Thread_Pool::worker_thread (this=0x7ffcce5b3080) at src/lib/utils/thread_utils/thread_pool.cpp:149
#33 0x00007fe8ec856c94 in std::execute_native_thread_routine (__p=0x55e86123fba0) at /usr/src/debug/sys-devel/gcc-15.0.9999/gcc-15.0.9999/libstdc++-v3/src/c++11/thread.cc:104
#34 0x00007fe8ec68bb82 in start_thread (arg=<optimized out>) at pthread_create.c:447
#35 0x00007fe8ec70f64c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

It looks like chimera (cc @q66) has a patch that might fix it though: https://github.com/chimera-linux/cports/blob/e753709bae72df5c2fd9e8b500143bb033a7bf54/main/botan/patches/fix-test-ffi-aead.patch.

@thesamesam
Copy link
Author

Ah, 3e0cb45.

@randombit
Copy link
Owner

Yes 3e0cb45 should backport cleanly to 3.6.1 and will resolve this

@q66
Copy link
Contributor

q66 commented Dec 22, 2024

it solves it by accident though (at least for some cases), see the comment in my patch (i was gonna submit my fix, and then i went through the code and saw it was already fixed, though not for the same reason)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants