Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add LIBCXX_HARDENING_MODE=fast to pinned reproducible builds #406

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

spoonincode
Copy link
Member

clang18 introduced LIBCXX_HARDENING_MODE. This is similar to GLIBCXX_ASSERTIONS: hardening checks in the c++ stdlib that are intended for production use. Many, maybe most, distros build their packages with GLIBCXX_ASSERTIONS: it is widely considered a good security practice and something like gcc's new -fhardened also enables it by default.

For more on LIBCXX_HARDENING_MODE see,
https://libcxx.llvm.org/Hardening.html

We already harden our reproducible builds with -D_FORTIFY_SOURCE=2 -fstack-protector-strong so let's add LIBCXX_HARDENING_MODE=fast. I am not seeing any performance degradation on a replay (within ~0.25%)

A nice feature of libc++'s implementation is that we can set a default at the build time of libc++ and that's always used by default even for user compiled code. That is the approach taken here.

As an example of this option working, see b84fab4 (on main w/o LIBCXX_HARDENING_MODE=fast) and cfbb581 (on this branch w/ LIBCXX_HARDENING_MODE=fast). Unfortunately just going to have to ignore the svnn_ibc_unit_test failures in these examples due to something on main being broken.
b84fab4: https://github.com/AntelopeIO/spring/actions/runs/10098083767/job/27924876431 You can see here that test_fc passes
cfbb581: https://github.com/AntelopeIO/spring/actions/runs/10098027444/job/27925337461 You can see here that test_fc fails

@spoonincode spoonincode merged commit 08df1a6 into main Jul 26, 2024
36 checks passed
@spoonincode spoonincode deleted the cxxharden branch July 26, 2024 15:06
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: CHORE
summary: Add hardened mode for reproducible builds.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants