Skip to content

valgrind: Conditional jump or move depends on uninitialised value(s) #29635

@fanquake

Description

@fanquake

I see this issue with latest master using Clang 17.0.6 on aarch64, and running the functional tests under Valgrind (3.22.0):

 node0 stderr ==75935== Thread 25 b-msghand:
==75935== Conditional jump or move depends on uninitialised value(s)
==75935==    at 0x1955B8: _M_reset (optional:313)
==75935==    by 0x1955B8: ~_Optional_payload (optional:437)
==75935==    by 0x1955B8: ~_Optional_base (optional:508)
==75935==    by 0x1955B8: GetLocalAddress(CNode const&) (???:220)
==75935==    by 0x1956A3: GetLocalAddrForPeer(CNode&) (net.cpp:240)
==75935==    by 0x1D091F: MaybeSendAddr (net_processing.cpp:5259)
==75935==    by 0x1D091F: (anonymous namespace)::PeerManagerImpl::SendMessages(CNode*) (???:5453)
==75935==    by 0x1AA183: CConnman::ThreadMessageHandler() (net.cpp:2886)
==75935==    by 0x750627: operator() (std_function.h:591)
==75935==    by 0x750627: util::TraceThread(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>) (???:21)
==75935==    by 0x1B290F: __invoke_impl<void, void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)> (invoke.h:61)
==75935==    by 0x1B290F: __invoke<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)> (invoke.h:96)
==75935==    by 0x1B290F: _M_invoke<0UL, 1UL, 2UL> (std_thread.h:292)
==75935==    by 0x1B290F: operator() (std_thread.h:299)
==75935==    by 0x1B290F: std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, CConnman::Start(CScheduler&, CConnman::Options const&)::$_5> > >::_M_run() (std_thread.h:244)
==75935==    by 0x4C501BF: execute_native_thread_routine (thread.cc:104)
==75935==    by 0x4F85E37: start_thread (pthread_create.c:447)
==75935==    by 0x4FF0E5B: thread_start (clone.S:79)
==75935== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:_M_reset
   fun:~_Optional_payload
   fun:~_Optional_base
   fun:_Z15GetLocalAddressRK5CNode
   fun:_Z19GetLocalAddrForPeerR5CNode
   fun:MaybeSendAddr
   fun:_ZN12_GLOBAL__N_115PeerManagerImpl12SendMessagesEP5CNode
   fun:_ZN8CConnman20ThreadMessageHandlerEv
   fun:operator()
   fun:_ZN4util11TraceThreadESt17basic_string_viewIcSt11char_traitsIcEESt8functionIFvvEE
   fun:__invoke_impl<void, void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)>
   fun:__invoke<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)>
   fun:_M_invoke<0UL, 1UL, 2UL>
   fun:operator()
   fun:_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvSt17basic_string_viewIcSt11char_traitsIcEESt8functionIFvvEEEPKcZN8CConnman5StartER10CSchedulerRKNSE_7OptionsEE3$_5EEEEE6_M_runEv
   fun:execute_native_thread_routine
   fun:start_thread
   fun:thread_start
}
==75935== 
==75935== Exit program on first error (--exit-on-first-error=yes)

Bisected to #28078 being the cause.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions