-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
WIP: rewrite hardening in plain nix #19512
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:
.spec
file for gcc, sadly unsupported on clang)all
flag more efficient (see 4bf0576 for details)CC @fpletz @globin
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)