Disable _FORTIFY_SOURCE when enable-debug #17033

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:fix-fortify changing 1 files +10 −5
  1. achow101 commented at 11:58 PM on October 2, 2019: member

    The _FORTIFY_SOURCE macro is enabled by default when hardening is enabled, but it requires optimization in order to be used. Since we disable all optimization with --enable-debug, this macro doesn't actually do anything and instead just causes a lot of warnings to be printed. This PR explicitly disables _FORTIFY_SOURCE so that these useless warnings aren't printed.

  2. fanquake added the label Build system on Oct 3, 2019
  3. laanwj commented at 3:00 AM on October 3, 2019: member

    I disagree with this, hardening should never be automatically disabled. Things such as stack cookies do not interfere with debugging at all, and if they do that's a bug that needs to be solved, it should be the default to debug as closely to the original code as possible.

    If this particular hardening feature really interferes with debugging then disable that, not all hardening features.

  4. achow101 force-pushed on Oct 3, 2019
  5. achow101 renamed this:
    Disable hardening when enable-debug
    Disable _FORTIFY_SOURCE when enable-debug
    on Oct 3, 2019
  6. achow101 commented at 4:16 PM on October 3, 2019: member

    I've changed this to just disable _FORTIFY_SOURCE when --enable-debug. It appears that it doesn't do anything with optimization level 0 (as we do for --enable-debug) except print that warning.

  7. in configure.ac:755 in 637df834b8 outdated
     748 | @@ -749,12 +749,14 @@ if test x$use_hardening != xno; then
     749 |    AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
     750 |    AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
     751 |  
     752 | -  AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[
     753 | -    AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[
     754 | -      HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -U_FORTIFY_SOURCE"
     755 | +  if test x$enable_debug != xyes; then
    


    laanwj commented at 5:38 AM on October 4, 2019:

    Maybe add a comment here (to explain the problem with debug here)


    achow101 commented at 6:22 PM on October 7, 2019:

    Done

  8. Disable _FORTIFY_SOURCE when enable-debug
    Since enable-debug disables optimization entirely, _FORTIFY_SOURCE
    does nothing as it requires some kind of optimization enabled. It
    instead produces a bunch of useless warnings. So explicitly disable
    it when enable-debug so that those warnings are not produced.
    44f7a8d7a7
  9. achow101 force-pushed on Oct 7, 2019
  10. laanwj commented at 8:27 AM on October 8, 2019: member

    Thanks. ACK 44f7a8d7a774f82417106c452d793e6f091bc23e

  11. laanwj requested review from dongcarl on Oct 8, 2019
  12. laanwj requested review from theuni on Oct 8, 2019
  13. laanwj referenced this in commit ee47461ea5 on Oct 15, 2019
  14. laanwj merged this on Oct 15, 2019
  15. laanwj closed this on Oct 15, 2019

  16. sidhujag referenced this in commit 82b285b411 on Oct 16, 2019
  17. luke-jr commented at 2:03 PM on November 4, 2019: member

    Posthumourous Concept NACK: --enable-debug can be used with explicitly-specified -On options, and that _FORTIFY_SOURCE currently does nothing for -O0 is a compiler detail, not inherent.

  18. MarkLTZ referenced this in commit 3b69b903d9 on Apr 6, 2020
  19. deadalnix referenced this in commit fc846cd036 on May 25, 2020
  20. PastaPastaPasta referenced this in commit ef2c36a0d8 on Jun 27, 2021
  21. PastaPastaPasta referenced this in commit 377a7b72fd on Jun 28, 2021
  22. PastaPastaPasta referenced this in commit 0fb153c3a0 on Jun 29, 2021
  23. PastaPastaPasta referenced this in commit 90b5c9cf54 on Jul 1, 2021
  24. PastaPastaPasta referenced this in commit e9615df7bc on Jul 1, 2021
  25. PastaPastaPasta referenced this in commit 4065f1cf68 on Jul 12, 2021
  26. PastaPastaPasta referenced this in commit a5779c2f8f on Jul 13, 2021
  27. PastaPastaPasta referenced this in commit a5d5bc5ecf on Jul 13, 2021
  28. MarcoFalke locked this on Dec 16, 2021


theunidongcarl


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-19 00:14 UTC

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