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

New package openssf-compiler-options #24192

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

xnox
Copy link
Member

@xnox xnox commented Jul 18, 2024

This package aims to provide compiler configuration files that set flags as per https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html

It also enables optimized builds by default, for Wolfi baseline ABI.

Two test pipelines introduced. One to ensure ELF binaries in hardened packages remain hardened. The other one to test integration of openssf-compiler-flags and compilers - such that one can execute the same test whenever compiler is updated or openssf-compiler-flags are updated.

For clang toolchains the config options are prepended to any user supplied options.

For gcc toolchains the spec file options are appended to any user supplied options, hence negative tests for already supplied options when overriding explicit upstream/user choices is not desired.

Compiler check verifies that with openssf-compiler-options installed, a given compiler produces hardened binaries without any environmental variables are command line arguments:

2024/07/31 16:25:46 WARN + hardening-check --color hello
2024/07/31 16:25:46 INFO hello:
2024/07/31 16:25:46 INFO  Position Independent Executable: yes
2024/07/31 16:25:46 INFO  Stack protected: yes
2024/07/31 16:25:46 INFO  Fortify Source functions: yes (some protected functions found)
2024/07/31 16:25:46 INFO  Read-only relocations: yes
2024/07/31 16:25:46 INFO  Immediate binding: yes
2024/07/31 16:25:46 INFO  Stack clash protection: yes
2024/07/31 16:25:46 INFO  Control flow integrity: yes

Reviews:

Pre-depends (done):

Follow-ups:

@xnox xnox force-pushed the openssf-compiler-flags branch 7 times, most recently from 1579382 to c987d57 Compare July 19, 2024 03:49
@xnox xnox force-pushed the openssf-compiler-flags branch 4 times, most recently from f85d104 to 618e0dd Compare July 31, 2024 15:48
@xnox xnox marked this pull request as ready for review July 31, 2024 15:49
@xnox xnox force-pushed the openssf-compiler-flags branch 4 times, most recently from b86e981 to d832312 Compare July 31, 2024 16:20
For now this is opt-in only, in the future it can be pulled in and
installed by default.
@pnasrat pnasrat self-requested a review August 1, 2024 10:52
Copy link
Member

@pnasrat pnasrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xnox xnox merged commit f64f42b into wolfi-dev:main Aug 1, 2024
8 checks passed
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.

2 participants