valgrind: Syscall param ppoll(ufds.events) points to uninitialised byte(s) #28072

issue fanquake openend this issue on July 12, 2023
  1. fanquake commented at 2:12 pm on July 12, 2023: member

    Using master, GCC 12.2.1, Valgrind 3.21.0 (system), aarch64, Alpine Linux (musl libc):

     0./test/functional/test_runner.py --combinedlogslen=19999 --timeout-factor=12 --jobs=9 --valgrind
     1...
     224/268 - p2p_dns_seeds.py failed, Duration: 9 s
     3....
     4 node0 2023-07-12T12:59:04.448921Z [init] [noui.cpp:56] [noui_InitMessage] init message: Done loading 
     5 node0 2023-07-12T12:59:04.453823Z [addcon] [util/thread.cpp:20] [TraceThread] addcon thread start 
     6 node0 2023-07-12T12:59:04.456041Z [msghand] [util/thread.cpp:20] [TraceThread] msghand thread start 
     7 test  2023-07-12T12:59:04.763000Z TestFramework.node0 (DEBUG): Stopping node 
     8 test  2023-07-12T12:59:04.763000Z TestFramework (ERROR): Assertion failed 
     9                                   Traceback (most recent call last):
    10                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 552, in start_nodes
    11                                       node.wait_for_rpc_connection()
    12                                     File "/bitcoin/test/functional/test_framework/test_node.py", line 235, in wait_for_rpc_connection
    13                                       raise FailedToStartError(self._node_msg(
    14                                   test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization
    15                                   During handling of the above exception, another exception occurred:
    16                                   Traceback (most recent call last):
    17                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 130, in main
    18                                       self.setup()
    19                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 295, in setup
    20                                       self.setup_network()
    21                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 389, in setup_network
    22                                       self.setup_nodes()
    23                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 411, in setup_nodes
    24                                       self.start_nodes()
    25                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 555, in start_nodes
    26                                       self.stop_nodes()
    27                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 570, in stop_nodes
    28                                       node.stop_node(wait=wait, wait_until_stopped=False)
    29                                     File "/bitcoin/test/functional/test_framework/test_node.py", line 346, in stop_node
    30                                       self.stop(wait=wait)
    31                                       ^^^^^^^^^
    32                                     File "/bitcoin/test/functional/test_framework/test_node.py", line 192, in __getattr__
    33                                       assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
    34                                                                     ^^^^^^^^^^^^^^^^^^^^
    35                                   AssertionError: [node 0] Error: no RPC connection
    36 test  2023-07-12T12:59:04.764000Z TestFramework (DEBUG): Closing down network thread 
    37 test  2023-07-12T12:59:04.814000Z TestFramework (INFO): Stopping nodes 
    38 test  2023-07-12T12:59:04.814000Z TestFramework.node0 (DEBUG): Stopping node 
    39
    40 node0 stderr ==30770== Thread 16 b-dnsseed:
    41==30770== Syscall param ppoll(ufds.events) points to uninitialised byte(s)
    42==30770==    at 0x405DCCC: ??? (in /lib/ld-musl-aarch64.so.1)
    43==30770==  Address 0x7d219a4 is on thread 16's stack
    44==30770== 
    45{
    46   <insert_a_suppression_name_here>
    47   Memcheck:Param
    48   ppoll(ufds.events)
    49   obj:/lib/ld-musl-aarch64.so.1
    50}
    51==30770== 
    52==30770== Exit program on first error (--exit-on-first-error=yes) 
    
     0254/268 - feature_config_args.py failed, Duration: 20 s
     1....
     2 node0 2023-07-12T13:16:16.303713Z [opencon] [util/thread.cpp:20] [TraceThread] opencon thread start 
     3 node0 2023-07-12T13:16:16.309602Z [opencon] [net.cpp:1633] [ThreadOpenConnections] Fixed seeds are disabled 
     4 test  2023-07-12T13:16:16.366000Z TestFramework (ERROR): Unexpected exception caught during testing 
     5                                   Traceback (most recent call last):
     6                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 131, in main
     7                                       self.run_test()
     8                                     File "/bitcoin/test/functional/feature_config_args.py", line 376, in run_test
     9                                       self.test_args_log()
    10                                     File "/bitcoin/test/functional/feature_config_args.py", line 182, in test_args_log
    11                                       self.start_node(0, extra_args=[
    12                                     File "/bitcoin/test/functional/test_framework/test_framework.py", line 537, in start_node
    13                                       node.wait_for_rpc_connection()
    14                                     File "/bitcoin/test/functional/test_framework/test_node.py", line 235, in wait_for_rpc_connection
    15                                       raise FailedToStartError(self._node_msg(
    16                                   test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization
    17 test  2023-07-12T13:16:16.367000Z TestFramework (DEBUG): Closing down network thread 
    18 test  2023-07-12T13:16:16.417000Z TestFramework (INFO): Stopping nodes 
    19 test  2023-07-12T13:16:16.417000Z TestFramework.node0 (DEBUG): Stopping node 
    20
    21 node0 stderr ==41539== Thread 15 b-addcon:
    22==41539== Syscall param ppoll(ufds.events) points to uninitialised byte(s)
    23==41539==    at 0x405DCCC: ??? (in /lib/ld-musl-aarch64.so.1)
    24==41539==  Address 0x8121724 is on thread 15's stack
    25==41539== 
    26{
    27   <insert_a_suppression_name_here>
    28   Memcheck:Param
    29   ppoll(ufds.events)
    30   obj:/lib/ld-musl-aarch64.so.1
    31}
    32==41539== 
    33==41539== Exit program on first error (--exit-on-first-error=yes) 
    

    Full logs: https://gist.github.com/fanquake/8e8ce3efcdbf77a85103a36c29c3e68c. Looking at other discussion, seems like this is likely a Valgrind false-positive, so we may just want to suppress.

  2. maflcko added the label Tests on Jul 12, 2023
  3. maflcko added the label Upstream on Jul 12, 2023
  4. maflcko commented at 3:42 pm on July 12, 2023: member

    To reproduce without tests:

     0# valgrind --gen-suppressions=all --quiet --error-exitcode=1 --suppressions=$PWD/contrib/valgrind.supp --exit-on-first-error=yes ./src/bitcoind -regtest -noconnect -addnode=some.node  -printtoconsole=0
     1==47801== Thread 25 b-addcon:
     2==47801== Syscall param ppoll(ufds.events) points to uninitialised byte(s)
     3==47801==    at 0x405DCCC: ??? (in /lib/ld-musl-aarch64.so.1)
     4==47801==  Address 0x823b724 is on thread 25's stack
     5==47801== 
     6{
     7   <insert_a_suppression_name_here>
     8   Memcheck:Param
     9   ppoll(ufds.events)
    10   obj:/lib/ld-musl-aarch64.so.1
    11}
    12==47801== 
    13==47801== Exit program on first error (--exit-on-first-error=yes)
    
  5. maflcko added the label P2P on Jul 12, 2023
  6. maflcko commented at 3:46 pm on July 12, 2023: member
    Maybe someone can transform this into a standalone minimal cpp file to submit to valgrind or musl?
  7. maflcko commented at 4:21 pm on July 12, 2023: member

    Done:

     0/bitcoin-core # cat /tmp/a.cpp 
     1#include <sys/types.h>
     2#include <sys/socket.h>
     3#include <netdb.h>
     4
     5int main(){
     6    addrinfo ai_hint{};
     7    ai_hint.ai_socktype = SOCK_STREAM;
     8    ai_hint.ai_protocol = IPPROTO_TCP;
     9    ai_hint.ai_family = AF_UNSPEC;
    10    ai_hint.ai_flags = true? AI_ADDRCONFIG : AI_NUMERICHOST;
    11    addrinfo* ai_res{nullptr};
    12    return getaddrinfo("foo.bar", nullptr, &ai_hint, &ai_res);
    13}
    14/bitcoin-core # clang++  /tmp/a.cpp -o /tmp/exe && valgrind --gen-suppressions=all --quiet /tmp/exe 
    15==77232== Syscall param ppoll(ufds.events) points to uninitialised byte(s)
    16==77232==    at 0x405DCCC: ??? (in /lib/ld-musl-aarch64.so.1)
    17==77232==  Address 0x1ffefff804 is on thread 1's stack
    18==77232== 
    19{
    20   <insert_a_suppression_name_here>
    21   Memcheck:Param
    22   ppoll(ufds.events)
    23   obj:/lib/ld-musl-aarch64.so.1
    24}
    
  8. fanquake commented at 1:20 pm on July 13, 2023: member
    Opened a bug report with Valgrind: https://bugs.kde.org/show_bug.cgi?id=472219
  9. maflcko commented at 6:49 am on July 17, 2023: member
    Ok, let’s continue discussion there.
  10. maflcko closed this on Jul 17, 2023

  11. fanquake referenced this in commit 0e6e628260 on Jul 25, 2023
  12. fanquake referenced this in commit 50f7214e09 on Jul 25, 2023
  13. fanquake referenced this in commit 95d523fabb on Jul 26, 2023
  14. sidhujag referenced this in commit 547b683157 on Aug 9, 2023
  15. eriknylund referenced this in commit ea56e1f46e on Aug 17, 2023
  16. bitcoin locked this on Jul 16, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me