-
-
Notifications
You must be signed in to change notification settings - Fork 13k
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
cc-wrapper: Remove redundant hardening #28555
cc-wrapper: Remove redundant hardening #28555
Conversation
@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @abbradar and @vcunat to be potential reviewers. |
The following parameters are now available: * hardeningDisable To disable specific hardening flags * hardeningEnable To enable specific hardening flags Only the cc-wrapper supports this right now, but these may be reused by other wrappers, builders or setup hooks. cc-wrapper supports the following flags: * fortify * stackprotector * pie (disabled by default) * pic * strictoverflow * format * relro * bindnow
afaik these are clear linker flags to control relocation on build/link-time since the addresses of the code-segments are known. I suspect these flags are passed with purpose to the gcc driver, who passes them to the linker in the end. |
Ah, per https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
But if it's just a pass-through, then we don't need to do this as the linker wrapper will add it anyways. |
77c5a4a
to
66e0c87
Compare
GCC just passes `-z ...` flags to ld unaltered, and they are already passed to LD anyways. On the other hand, `-pie` affects gcc behavior too.
This becomes necessary if more wrappers besides cc-wrapper start supporting hardening flags. Also good to make the warning into an error. Also ensure interface is being used right: Not as a string, not just in bash.
66e0c87
to
345885f
Compare
@globin based on the hydra job I think this will be good to merge tomorrow if my Darwin stdenv build finishes? |
@Ericson2314 The next commit 97a4883 broke the evaluation of
I don't understand why… |
This change to
but
|
Ah, and I was just about to post $ nix-instantiate --eval --show-trace -E '((import ./. {}).busybox.override { enableStatic = true; }).hardeningDisable' So, what do you think is going on?
|
Is this a bug in Nix?
|
No, it's my mistake of testing with |
that evaluates to |
- allow "all" in hardeningDisable - fix busybox flags - print detailed error message Discussed at NixOS#28555 (comment)
- allow "all" in hardeningDisable - fix busybox flags - print detailed error message Discussed at #28555 (comment) (cherry picked from commit d70006c)
Motivation for this change
I can't find these flags (
-z relno
-z now
) documented for GCC anywhere, and they are already passed to ld anyways.Based on aff1f4a, I think these were accidentally passed to the C compiler from the beginning.
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/
)