Skip to content

Conversation

achow101
Copy link
Member

@achow101 achow101 commented Oct 2, 2019

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.

@laanwj
Copy link
Member

laanwj commented Oct 3, 2019

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.

@achow101 achow101 changed the title Disable hardening when enable-debug Disable _FORTIFY_SOURCE when enable-debug Oct 3, 2019
@achow101
Copy link
Member Author

achow101 commented Oct 3, 2019

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.

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.
@laanwj
Copy link
Member

laanwj commented Oct 8, 2019

Thanks. ACK 44f7a8d

@laanwj laanwj requested review from dongcarl and theuni October 8, 2019 08:30
laanwj added a commit that referenced this pull request Oct 15, 2019
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
@laanwj laanwj merged commit 44f7a8d into bitcoin:master Oct 15, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 16, 2019
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
@luke-jr
Copy link
Member

luke-jr commented Nov 4, 2019

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.

MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Apr 6, 2020
- Fix gcc 9 warnings bitcoin#16995
- guix: Remove now-unnecessary gcc make flag bitcoin#18320
- build: Remove workaround for ancient libtool bitcoin#17066
- build: Add variable printing target to Makefiles bitcoin#17087
- Disable _FORTIFY_SOURCE when enable-debug bitcoin#17033
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 25, 2020
Summary:
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.

---

Backport of Core [[bitcoin/bitcoin#17033 | PR17033]]

Test Plan:
  mkdir build-autotools
  ../autogen.sh
  ../configure --enable-deprecated-build-system --enable-debug

see that -U_FORTIFY_SOURCE and -D_FORTIFY_SOURCE=2 are absent from CXX flags, while

  ../configure --enable-deprecated-build-system

has them set

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6244
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 12, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 13, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 13, 2021
44f7a8d Disable _FORTIFY_SOURCE when enable-debug (Andrew Chow)

Pull request description:

  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.

ACKs for top commit:
  laanwj:
    Thanks. ACK 44f7a8d

Tree-SHA512: e9302aef794dfd9ca9d0d032179ecc51d3212a9a0204454419f410011343b27c32e6be05f385051b5b594c607b91b8e0e588f644584d6684429a649a413077d9
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants