New package openssf-compiler-options #24192
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Reviews:
-- https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
-- https://github.com/wolfi-dev/os/blob/main/build-x86_64.env
-- https://github.com/wolfi-dev/os/blob/main/build-aarch64.env
-- defaults passed to gcc, which at compiler configuration time not available for clang thus
-- https://github.com/wolfi-dev/os/blob/main/gcc.yaml#L52
Pre-depends (done):
Follow-ups: