32-bit test failure: test/crypto_tests.cpp(561): error: in “crypto_tests/sha256d64”: check memcmp(out1, out2, 32 * i) == 0 has failed #14580

issue error10 openend this issue on October 26, 2018
  1. error10 commented at 3:28 am on October 26, 2018: contributor

    A test in the bitcoin test suite is failing for me while running the sha256d64 test cases in crypto_tests.cpp, but only on 32-bit distro. It passes on 64-bit.

    I expected the test suite to pass.

    The test suite log is:

     0$ cat test/crypto_tests.cpp.log
     1Running 11 test cases...
     2Entering test module "Bitcoin Test Suite"
     3test/crypto_tests.cpp(23): Entering test suite "crypto_tests"
     4test/crypto_tests.cpp(217): Entering test case "ripemd160_testvectors"
     5test/crypto_tests.cpp(217): Leaving test case "ripemd160_testvectors"; testing time: 343157us
     6test/crypto_tests.cpp(233): Entering test case "sha1_testvectors"
     7test/crypto_tests.cpp(233): Leaving test case "sha1_testvectors"; testing time: 200719us
     8test/crypto_tests.cpp(249): Entering test case "sha256_testvectors"
     9test/crypto_tests.cpp(249): Leaving test case "sha256_testvectors"; testing time: 518373us
    10test/crypto_tests.cpp(271): Entering test case "sha512_testvectors"
    11test/crypto_tests.cpp(271): Leaving test case "sha512_testvectors"; testing time: 1071278us
    12test/crypto_tests.cpp(308): Entering test case "hmac_sha256_testvectors"
    13test/crypto_tests.cpp(308): Leaving test case "hmac_sha256_testvectors"; testing time: 10312us
    14test/crypto_tests.cpp(361): Entering test case "hmac_sha512_testvectors"
    15test/crypto_tests.cpp(361): Leaving test case "hmac_sha512_testvectors"; testing time: 22518us
    16test/crypto_tests.cpp(429): Entering test case "aes_testvectors"
    17test/crypto_tests.cpp(429): Leaving test case "aes_testvectors"; testing time: 3358us
    18test/crypto_tests.cpp(445): Entering test case "aes_cbc_testvectors"
    19test/crypto_tests.cpp(445): Leaving test case "aes_cbc_testvectors"; testing time: 4206us
    20test/crypto_tests.cpp(497): Entering test case "chacha20_testvector"
    21test/crypto_tests.cpp(497): Leaving test case "chacha20_testvector"; testing time: 3051us
    22test/crypto_tests.cpp(527): Entering test case "countbits_tests"
    23test/crypto_tests.cpp(527): Leaving test case "countbits_tests"; testing time: 63452us
    24test/crypto_tests.cpp(549): Entering test case "sha256d64"
    25test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    26test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    27test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    28test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    29test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    30test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    31test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    32test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    33test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    34test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    35test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    36test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    37test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    38test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    39test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    40test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    41test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    42test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    43test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    44test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    45test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    46test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    47test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    48test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    49test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    50test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    51test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    52test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    53test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    54test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    55test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    56test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    57test/crypto_tests.cpp(549): Leaving test case "sha256d64"; testing time: 5115us
    58test/crypto_tests.cpp(23): Leaving test suite "crypto_tests"; testing time: 2246048us
    59Leaving test module "Bitcoin Test Suite"; testing time: 2246167us
    60
    61*** 32 failures are detected in the test module "Bitcoin Test Suite"
    

    This is occurring on Fedora 29 i686 while building bitcoin. The builder has 4GB RAM. This environment includes boost 1.66.0 and openssl 1.1.1. The test passes while building bitcoin on Fedora 29 x86_64 on the same machine. The test also passed on Fedora 28 i686, which has boost 1.66.0 and openssl 1.1.0i.

    This is bitcoin 0.17.0 obtained from thhe github release tagged v0.17.0.

    I glanced at the test but I didn’t see anything obvious that might cause it to fail on a 32-bit system. I would appreciate a hint as to where to look next.

  2. fanquake added the label Tests on Oct 26, 2018
  3. maflcko commented at 11:59 am on October 26, 2018: member
    Could you also check if branch 16 and branch master are affected, please?
  4. error10 commented at 4:16 pm on October 26, 2018: contributor

    Could you also check if branch 16 and branch master are affected, please?

    The test passes on v0.16.3, and fails identically as above on master. But it turns out this test is not present in 0.16.3 anyway.

  5. sipa commented at 4:25 pm on October 26, 2018: member
    Do you have the same issue with release binaries?
  6. error10 commented at 4:38 pm on October 26, 2018: contributor

    Do you have the same issue with release binaries?

    Good call. I downloaded bitcoin-0.17.0-i686-pc-linux-gnu.tar.gz, and its included bin/test_bitcoin passes. So, I guess I don’t have the same issue with release binaries.

  7. maflcko commented at 6:21 pm on November 2, 2018: member
    I believe this also happens 32bit Ubuntu Cosmic.
  8. error10 commented at 9:02 pm on November 2, 2018: contributor

    I believe this also happens 32bit Ubuntu Cosmic.

    I don’t just believe. I tested it, and sure enough it blows up on Ubuntu 18.10 i386, identically as above.

    Cosmic also has openssl 1.1.1, so perhaps it’s something specific to 1.1.1? A 32-bit openssl bug maybe?

  9. pkepler commented at 1:28 am on January 16, 2019: none
    I am running 0.15.1 that won’t upgrade on a raspberry pi 3 B. If I can help in any way with testing I would be glad to.
  10. error10 commented at 2:20 am on January 16, 2019: contributor

    I am running 0.15.1 that won’t upgrade on a raspberry pi 3 B. If I can help in any way with testing I would be glad to.

    You can just run a 64-bit distro on the RPi 3. Until Raspbian goes 64-bit, Fedora is probably your best bet. And then you can just pick up my aarch64 repo if you want.

  11. maflcko commented at 3:48 pm on February 13, 2019: member
    As a workaround you could build from our ./depends (which comes with an older openssl)
  12. error10 commented at 4:09 pm on February 13, 2019: contributor
    If 32-bit support were officially just dropped, I wouldn’t complain. Aside from ancient Raspberry Pi 1 and 2s and the occasional antique netbook, there’s virtually no hardware out there these days that requires a 32-bit OS. And the resource requirements of Bitcoin seem unlikely to shrink in the future.
  13. maflcko commented at 4:13 pm on February 13, 2019: member
    Oh, we didn’t drop support for 32-bit. This is just a bug introduced in a newer version of openssl, but no one looked into it to understand what happened or how it could be worked around.
  14. maflcko commented at 2:35 pm on May 2, 2019: member
    I am seeing this running the gitian build (which is built with depends) on ubuntu_xenial_armhf … :weary:
  15. maflcko commented at 6:54 pm on May 2, 2019: member

    Steps to reproduce on fresh Ubuntu Bionic 64-bit:

     0dpkg --add-architecture i386
     1apt update && apt install wget libc6:i386 libncurses5:i386 libstdc++6:i386
     2wget https://bitcoincore.org/bin/bitcoin-core-0.18.0/bitcoin-0.18.0-i686-pc-linux-gnu.tar.gz
     3tar -xzf bitcoin-0.18.0-i686-pc-linux-gnu.tar.gz
     4./bitcoin-0.18.0/bin/test_bitcoin -t crypto_tests
     5Running 11 test cases...
     6test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
     7test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
     8test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
     9test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    10test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    11test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    12test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    13test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    14test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    15test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    16test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    17test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    18test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    19test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    20test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    21test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    22test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    23test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    24test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    25test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    26test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    27test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    28test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    29test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    30test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    31test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    32test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    33test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    34test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    35test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    36test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    37test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    38
    39*** 32 failures are detected in the test module "Bitcoin Test Suite"
    
  16. maflcko commented at 7:14 pm on May 2, 2019: member

    Why is the travis 32-bit not failing?

    https://travis-ci.org/bitcoin/bitcoin/jobs/527334881#L2853

  17. maflcko commented at 8:34 pm on May 2, 2019: member
    So I guess it has nothing to do with openssl
  18. maflcko commented at 9:11 pm on May 2, 2019: member

    I can reproduce also on vanilla fedora 30 - 32 bit

    Schermafdruk van 2019-05-02 17-09-39

  19. sipa commented at 9:13 pm on May 2, 2019: member
    @MarcoFalke What does the “Using the ‘%s’ SHA256 implementation” say on that system/build? Also what does cat /proc/cpuinfo | fgrep flags say?
  20. maflcko commented at 9:20 pm on May 2, 2019: member
    0$ ./src/bitcoind -printtoconsole -regtest | grep SHA
    12019-05-02T21:19:53Z Using the 'standard,sse41(4way),avx2(8way)' SHA256 implementation
    2
    3
    4$ cat /proc/cpuinfo | fgrep flags | uniq -c
    5      8 flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault ssbd ibrs ibpb tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves arat umip
    
  21. sipa commented at 3:43 am on May 5, 2019: member
    I believe this is a GCC bug, filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348
  22. practicalswift commented at 7:55 am on May 5, 2019: contributor
    @sipa Excellent work! This sure looks like a miscompilation bug in gcc: the test case does not contain any UB that would give gcc the leeway to behave this way.
  23. laanwj referenced this in commit fd61b9fc22 on May 16, 2019
  24. sidhujag referenced this in commit abbe50b4a1 on May 18, 2019
  25. practicalswift commented at 4:53 pm on May 26, 2019: contributor
    Can be closed now that #15983 has been merged? @error10, thanks a lot for reporting! This turned out to be a very valuable bug report.
  26. maflcko closed this on May 27, 2019

  27. PastaPastaPasta referenced this in commit c019c6346a on Jun 27, 2021
  28. PastaPastaPasta referenced this in commit d5e4873c40 on Jun 28, 2021
  29. PastaPastaPasta referenced this in commit 166c770296 on Jun 29, 2021
  30. PastaPastaPasta referenced this in commit 6d3605d245 on Jul 1, 2021
  31. PastaPastaPasta referenced this in commit 8804421c39 on Jul 1, 2021
  32. PastaPastaPasta referenced this in commit fc4c9f49e5 on Jul 8, 2021
  33. PastaPastaPasta referenced this in commit 55c35078a5 on Jul 10, 2021
  34. bitcoin locked this on Dec 16, 2021
  35. hebasto commented at 9:03 am on February 7, 2023: member

    I believe this is a GCC bug, filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348

    It looks like the bug has been fixed in GCC 12.1+.

  36. bitcoin unlocked this on Feb 7, 2023
  37. bitcoin locked this on Feb 7, 2023
  38. bitcoin unlocked this on Feb 7, 2023
  39. gades referenced this in commit f36d273496 on Nov 21, 2023
  40. gades referenced this in commit c52120d468 on Dec 9, 2023
  41. bitcoin locked this on Feb 7, 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-12-24 15:12 UTC

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