-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
make-derivation: enable pie hardening with musl #49704
Conversation
Please describe in the commit what it fixes instead of just referring to an issue. |
Fixes NixOS#49071 On ld.gold, we produce broken executables when linking with the Musl libc. This appears to be a known bug when using ld.gold and Musl. This thread describes the workaround as enabling PIE when using ld.gold and Musl: https://www.openwall.com/lists/musl/2015/05/01/5 By default we don’t enable PIE to avoid breaking things. But in the Musl case we are breaking things by not enabling PIE. So this adds a special case for defaultHardeningFlags which keeps the pie hardening for everything. Any packages that break with PIE can add the pie flag to disableHardeningFlags array (a no-op for now on anything but Musl).
f3e8818
to
47a634a
Compare
Thanks- updated. |
Would it make sense to enable PIE by default? Or rather, what's the reason we don't do this always? Is performance the concern or breakage (or ...)? Performance seems like a bad reason, don't other distributions enable by default? Such a trade-off seems like it should be opt-in, but regardless first it'd be good to sort out what the reason is before disagreeing with it :P. |
I am thinking of just doing this for now as it avoid a mass rebuild. If someone wants to try enabling PIE globally, that would be great. It will just probably be on you to debug any of the new failures. |
Sound good, sorry didn't mean to make that your problem/job.... just
surprised we don't already :).
…On Mon, 05 Nov 2018 18:29:13 -0800, Matthew Bauer ***@***.***> wrote:
I am thinking of just doing this for now as it avoid a mass rebuild. If someone wants to try enabling PIE globally, that would be great. It will just probably be on you to debug any of the new failures.
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#49704 (comment) part: text/html
|
IIRC we tried that at first but it caused too much breakage so we didn't go that far. |
I'm seeing this break musl immediately? https://gist.github.com/dtzWill/d93dc2211fd2d134a81cd858311f42ce
What sort of builds does this not break (and presumably improves behavior for)? Checking behavior across branches presently... @GrahamcOfBorg build pkgsMusl.bash |
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: pkgsMusl.bash Partial log (click to expand)
|
Unexpected error: command failed with exit code 1 on aarch64-linux (full log) Attempted: pkgsMusl.bash Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: pkgsMusl.bash Partial log (click to expand)
|
So this seems to only break things, is there a case for not reverting it? Otherwise please do so... (or I'll do so in a day or two) |
That should be fixed in 2e2afa1. Hoping binutils/gcc are the only ones. |
Additional failures:
I'm a fan of this but this looks like it was merged too eagerly and wasn't... tested at all? Including checking if the original issue was fixed since build fails long before that point AFAICT. FWIW here's a few packages that no one's obligated to support BUT I build regularly and so they work reasonably well as oracles, even if they're not intended to be such:
|
glibc is just an addition to hardeningDisable, ghc is a bit trickier. Currently testing this: dtzWill@0caf0a3 (will report back in an hour or however long ghc takes :P). |
Nope, looks like problem is with bootstrap ghc not being built -fPIC -- so either new bootstrap tarball (eep) or maybe just disable PIE for ghc? Shame b/c it might be nice to use gold linker with it... |
Yeah i was probably too quick with this! Sorry about that. I didn’t think pie could break so much. Feel free to revert it (but leave in the hardeningDisable flags for future reference). |
I would say just disable PIE for ghc. There's some weird stuff ghc bootstrapping does that makes this stuff complex. We have to do some weird patches to get this working on Android: We do have a cross-trunk jobset with some musl jobs: https://hydra.nixos.org/jobset/nixpkgs/cross-trunk#tabs-jobs Maybe we should add cachix to it? |
Related problem with writeup: #129247 (comment) |
Fixes #49071