build: control flow instrumentation not always present in test_bitcoin main #21888

issue fanquake openend this issue on May 9, 2021
  1. fanquake commented at 7:06 am on May 9, 2021: member

    As noticed in #21135, main in our macOS and Windows test_bitcoin binaries doesn’t contain control flow instrumentation. This is because main for those binaries is provided by Boost, and when we compile Boost in depends, we don’t build with -fcf-protection=full, like we do in configure. The reason the Linux test_bitcoin binaries contain instrumentation is because the GCC used to build them is patched by Ubuntu to enable -fcf-protection=full by default.

    Fixing this isn’t as simple as building Boost in depends with -fcf-protection=full, because we still support compilers that don’t support that option, and we don’t currently have a way to test-before-using in depends. However, given that this only affects test_bitcoin, and only macOS and Windows, we can probably just do the following:

    For macOS, we can actually just build Boost with -fcf-protection=full, as our cross-compiler (LLVM Clang 10) supports this option, and any Apple Clang we’d expected to be used for building depends should also support it.

    For Windows, the x86_64-w64-mingw32-g++ in Bionic in based off GCC 7.3.0, and therefore doesn’t support -fcf-protection (introduced in GCC 8). Given we’d expect users to be cross-compiling for Windows on Bionic for a while longer yet, we can just implement the control flow checks, but skip it for test_bitcoin.

    For Linux, we don’t need to do anything build wise, just add the instrumentation checks. I would probably prefer to do this when we are using LIEF for Linux.

  2. fanquake added the label Build system on May 9, 2021
  3. fanquake added the label Scripts and tools on May 9, 2021
  4. laanwj referenced this in commit ecf5f2c1a0 on May 14, 2021
  5. sidhujag referenced this in commit d8f8fb752f on May 14, 2021
  6. fanquake referenced this in commit 19815b096c on Nov 21, 2021
  7. sidhujag referenced this in commit e10e74aa7e on Nov 21, 2021
  8. sidhujag referenced this in commit 53cc664727 on Nov 23, 2021
  9. laanwj referenced this in commit 8319c4e906 on Jan 4, 2022
  10. sidhujag referenced this in commit 23e2b1da75 on Jan 4, 2022
  11. laanwj closed this on Jan 25, 2022

  12. sidhujag referenced this in commit 172f39e5ff on Jan 28, 2022
  13. PastaPastaPasta referenced this in commit bab7b055f9 on Jun 19, 2022
  14. PastaPastaPasta referenced this in commit 5fd6b64e72 on Jun 19, 2022
  15. DrahtBot locked this on Jan 25, 2023

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-07-05 19:13 UTC

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