WIP: rewrite hardening in plain nix#19512
WIP: rewrite hardening in plain nix#19512groxxda wants to merge 7 commits intoNixOS:stagingfrom groxxda:hardeningInNix
Conversation
The logic is now done in nix. This adds the benefit that hardening is now more lazy. Previously a change to add-hardening.sh caused a full rebuild.
This adds an attribute to the cc derivation that indicates which hardening flags are supported. Fixes #18995: nix-shell -p uses stdenvNoCC to build the environment. Thus stdenv.cc.cc.hardeningSupported is undefined and no hardening flags are turned on.
Since it was supported before, add it here. The implementation favors readability over performance: The case hardeningDisable=["all"] is unnecessarily unperformant.
|
@fpletz can I help with the remaining todos? |
|
Yes, please start if you can. I will have time again to look at these issues at the weekend. Too much dayjob-stuff to do. |
|
@fpletz can you share your work for spec files somewhere? |
|
I'm a big fan of doing more in Nix (see my cmakeFlags/configureFlags PRs), but since this adds more processing to |
|
We need to keep supporting Edit: this could also be |
|
@fpletz I think our best shot to handle pie gracefully is to modify (ld,cc)-wrapper instead of using spec files. Something along [pseudo code] just before the debug print.. |
|
Cool. How's this coming? Also, @grahamc security |
|
Friendly bump. Are the remaining TODOs blockers? |
|
Any progress here? |
|
Closing in favour of #28029. |
Motivation for this change
Doing it in nix makes it more lazy.
See commit messages for more details
Fixes #18995
This PR is not ready to merge.
I post it to get feedback on the changes.
TODO:
.specfile for gcc, sadly unsupported on clang)allflag more efficient (see 4bf0576 for details)CC @fpletz @globin
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandboxinnix.confon non-NixOS)
nix-shell -p nox --run "nox-review wip"./result/bin/)