Skip to content

Conversation

@mszabo-wikia
Copy link
Contributor

Update and extend the list of hardening-related compiler flags used by HHVM to better represent modern distro defaults.

  • Convert the existing ENABLE_SSP build option into a new ENABLE_HARDENING option and put an updated list of security flags behind it. Both clang and GCC have been supporting these options for a while now, so we can set them irrespective of the compiler.
  • Put PIE-related options behind a separate ENABLE_PIE build option so that we can produce and compare non-PIE and PIE builds once we fix compatibility with PIE.
  • Forward CMAKE_BUILD_TYPE to vendored subprojects. Lack of this was causing the projects to be built without compiler optimizations, which doesn't play well with FORTIFY_SOURCE.

On systems with glibc >= 2.40, facebook/folly#2519 is needed for this option to work.

The overhead from these flags is likely to be limited, as many of them have been set by default for distribution packages for several years now.[1]

[1] https://github.com/jvoisin/compiler-flags-distro

Update and extend the list of hardening-related compiler flags
used by HHVM to better represent modern distro defaults.

* Convert the existing `ENABLE_SSP` build option into a new
  `ENABLE_HARDENING` option and put an updated list of security flags behind it.
  Both clang and GCC have been supporting these options for a while now,
  so we can set them irrespective of the compiler.
* Put PIE-related options behind a separate `ENABLE_PIE` build option
  so that we can produce and compare non-PIE and PIE builds once we fix
  compatibility with PIE.
* Forward `CMAKE_BUILD_TYPE` to vendored subprojects. Lack of this
  was causing the projects to be built without compiler optimizations,
  which doesn't play well with `FORTIFY_SOURCE`.

On systems with glibc >= 2.40, facebook/folly#2519
is needed for this option to work.

The overhead from these flags is likely to be limited, as many of them
have been set by default for distribution packages for several years now.[1]

[1] https://github.com/jvoisin/compiler-flags-distro
@meta-cla meta-cla bot added the CLA Signed label Nov 18, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 18, 2025

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D87347762. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant