cc-wrapper: add fortify flags after invocation args, not before#246244
cc-wrapper: add fortify flags after invocation args, not before#246244risicle merged 1 commit intoNixOS:stagingfrom
Conversation
fc1967c to
f95bb9b
Compare
|
If we go down this route, would it make sense to move more (or even all) of these to the end, so that the UI is a consistent "hardening flags are forced and must be overridden out-of-band"? |
|
👍 Building:
|
this splits hardeningCFlags into hardeningCFlagsAfter and hardeningCFlagsBefore (where most flags still remain) to allow us to *append* `-D_FORTIFY_SOURCE=` values to the command-line, forcing our choice of fortify level and avoiding potential redefinition warnings/errors through use of `-U_FORTIFY_SOURCE`
f95bb9b to
658ab4b
Compare
|
We should be able to revert a bunch of the |
|
If it works as intended and we don't have to revert this |
|
Had to add |
|
Out of interest what error were you getting without that? Also, is it only required for |
|
I still have to debug a bit further to fully understand what's happening. One error was |
|
I think that musl does not implement |
|
Also recently merged: #219421 |
|
Was it one of the calls in |
Ah, I knew I'd seen something related to this recently. I guess it's more complex than just " |
|
It might take me a while to build all the musl build-deps for thunderbird. If you're able to narrow it down to a test case to add to #217390 that would help things along. |
|
Yup, it's in |
|
https://clang.llvm.org/docs/UsersManual.html#gcc-extensions-not-implemented-yet
Having tested this, it's actually #219421 that's the culprit. The build fails in a similar way if the cc-wrapper makes no attempt to alter Suggest we disable the fortify-headers for musl/clang until we figure out how best to selectively omit the |
|
Ok I think I have a fix, it moves the compilation of Was this a pre-existing error? |
|
Sorry I did not provide the complete information. |
|
Oh good. My vague theory with the This makes me wish there were a nice way to omit the fortify headers on a package-by-package basis. Ideally they would omit themselves if |
|
Hey, with this change, how would we disable FORTIFY_SOURCE for just one invocation? tpm2-pytss is broken since it needs to disable fortify for running the preprocessor when parsing types, but it doesnt disable fortify package-wide as it builds objects which should have fortify. |
|
The ultimate thing that controls the behaviour of the cc-wrapper is the Suggest grepping nixpkgs for examples of its (rare) use. (note the order of the two is important there, and consider why) However, that being said, doing a |
Hardening got enabled in NixOS#246244 in a way that makes it difficult to disable for projects to disable selectively. The fix used in NixOS#245139 (and provided upstream) no longer works, and we need to disable hardening entirely to make `pycparser` which is unable to handle fortify bits. Fixes NixOS#252023. Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
Description of changes
An alternative to #246067, attempting to address issues raised in #224822
This splits
hardeningCFlagsintohardeningCFlagsAfterandhardeningCFlagsBefore(where most flags still remain) to allow us to append-D_FORTIFY_SOURCE=values to the command-line, forcing our choice of fortify level and avoiding potential redefinition warnings/errors through use of-U_FORTIFY_SOURCE.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)cc @emilazy