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 opened 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:

    $ cat test/crypto_tests.cpp.log
    Running 11 test cases...
    Entering test module "Bitcoin Test Suite"
    test/crypto_tests.cpp(23): Entering test suite "crypto_tests"
    test/crypto_tests.cpp(217): Entering test case "ripemd160_testvectors"
    test/crypto_tests.cpp(217): Leaving test case "ripemd160_testvectors"; testing time: 343157us
    test/crypto_tests.cpp(233): Entering test case "sha1_testvectors"
    test/crypto_tests.cpp(233): Leaving test case "sha1_testvectors"; testing time: 200719us
    test/crypto_tests.cpp(249): Entering test case "sha256_testvectors"
    test/crypto_tests.cpp(249): Leaving test case "sha256_testvectors"; testing time: 518373us
    test/crypto_tests.cpp(271): Entering test case "sha512_testvectors"
    test/crypto_tests.cpp(271): Leaving test case "sha512_testvectors"; testing time: 1071278us
    test/crypto_tests.cpp(308): Entering test case "hmac_sha256_testvectors"
    test/crypto_tests.cpp(308): Leaving test case "hmac_sha256_testvectors"; testing time: 10312us
    test/crypto_tests.cpp(361): Entering test case "hmac_sha512_testvectors"
    test/crypto_tests.cpp(361): Leaving test case "hmac_sha512_testvectors"; testing time: 22518us
    test/crypto_tests.cpp(429): Entering test case "aes_testvectors"
    test/crypto_tests.cpp(429): Leaving test case "aes_testvectors"; testing time: 3358us
    test/crypto_tests.cpp(445): Entering test case "aes_cbc_testvectors"
    test/crypto_tests.cpp(445): Leaving test case "aes_cbc_testvectors"; testing time: 4206us
    test/crypto_tests.cpp(497): Entering test case "chacha20_testvector"
    test/crypto_tests.cpp(497): Leaving test case "chacha20_testvector"; testing time: 3051us
    test/crypto_tests.cpp(527): Entering test case "countbits_tests"
    test/crypto_tests.cpp(527): Leaving test case "countbits_tests"; testing time: 63452us
    test/crypto_tests.cpp(549): Entering test case "sha256d64"
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(549): Leaving test case "sha256d64"; testing time: 5115us
    test/crypto_tests.cpp(23): Leaving test suite "crypto_tests"; testing time: 2246048us
    Leaving test module "Bitcoin Test Suite"; testing time: 2246167us
    
    *** 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:

    dpkg --add-architecture i386
    apt update && apt install wget libc6:i386 libncurses5:i386 libstdc++6:i386
    wget https://bitcoincore.org/bin/bitcoin-core-0.18.0/bitcoin-0.18.0-i686-pc-linux-gnu.tar.gz
    tar -xzf bitcoin-0.18.0-i686-pc-linux-gnu.tar.gz
    ./bitcoin-0.18.0/bin/test_bitcoin -t crypto_tests
    Running 11 test cases...
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    test/crypto_tests.cpp(561): error: in "crypto_tests/sha256d64": check memcmp(out1, out2, 32 * i) == 0 has failed
    
    *** 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
    $ ./src/bitcoind -printtoconsole -regtest | grep SHA
    2019-05-02T21:19:53Z Using the 'standard,sse41(4way),avx2(8way)' SHA256 implementation
    
    
    $ cat /proc/cpuinfo | fgrep flags | uniq -c
          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: 2026-04-13 21:15 UTC

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