random: fix crash on some 64bit platforms #10614

pull theuni wants to merge 1 commits into bitcoin:master from theuni:fix-osx-crash changing 1 files +8 −2
  1. theuni commented at 7:01 PM on June 16, 2017: member

    Fixes #10611. Credit @sipa.

    rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash in particular, it was holding a stack canary which was not properly restored after the cpuid.

    Split out the x86+PIC case so that x86_64 doesn't have to worry about it.

  2. sipa commented at 7:04 PM on June 16, 2017: member

    utACK b9b87481fd69e5caa15f580a19a5e0a58ad5f6a6

  3. random: fix crash on some 64bit platforms
    rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash
    in particular, it was holding a stack canary which was not properly restored
    after the cpuid.
    
    Split out the x86+PIC case so that x86_64 doesn't have to worry about it.
    9af207c810
  4. in src/random.cpp:75 in b9b87481fd outdated
      72 | @@ -73,9 +73,15 @@ static constexpr uint32_t CPUID_F1_ECX_RDRAND = 0x40000000;
      73 |  static void RDRandInit()
      74 |  {
      75 |      //! When calling cpuid function #1, ecx register will have this set if RDRAND is available.
    


    sipa commented at 7:06 PM on June 16, 2017:

    While you're at it, can you move this comment down to after the #endif? It's intended to clarify the CPUID_F1_ECX_RDRAND constant.


    theuni commented at 7:19 PM on June 16, 2017:

    Done

  5. theuni force-pushed on Jun 16, 2017
  6. jonasschnelli commented at 7:34 PM on June 16, 2017: contributor

    tested ACK 9af207c810b5c4b09ccbdec75582b3e34e32e8cc (OSX 10.12 only) full static build via gitian: https://bitcoin.jonasschnelli.ch/build/181 Confirmed that it fixes #10611

  7. sipa commented at 9:30 PM on June 16, 2017: member

    utACK 9af207c810b5c4b09ccbdec75582b3e34e32e8cc

  8. sipa commented at 11:40 PM on June 16, 2017: member

    Fixes #10611. Credit @sipa.

    You can also add a blame for introducing the bug in the first place.

  9. gmaxwell approved
  10. gmaxwell commented at 12:28 AM on June 17, 2017: contributor

    utACK

  11. sipa merged this on Jun 17, 2017
  12. sipa closed this on Jun 17, 2017

  13. sipa referenced this in commit cafe24f039 on Jun 17, 2017
  14. PastaPastaPasta referenced this in commit 21b0afaf0f on Jul 5, 2019
  15. PastaPastaPasta referenced this in commit 62188441d0 on Jul 5, 2019
  16. PastaPastaPasta referenced this in commit 17e621dd23 on Jul 6, 2019
  17. PastaPastaPasta referenced this in commit fc40c0a97c on Jul 8, 2019
  18. PastaPastaPasta referenced this in commit b73dc48b77 on Jul 9, 2019
  19. PastaPastaPasta referenced this in commit 5ac6d7c4e5 on Jul 9, 2019
  20. barrystyle referenced this in commit eacee67e0b on Jan 22, 2020
  21. DrahtBot locked this on Sep 8, 2021

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