Merge branch 'hardened-stdenv' into staging
Closes #12895 Amazing work by @globin & @fpletz getting hardened compiler flags by enabled default on the whole package set
This commit is contained in:
@@ -49,14 +49,9 @@ stdenv.mkDerivation {
|
||||
|
||||
NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations";
|
||||
|
||||
preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules)
|
||||
+ optionalString (hardening && (stdenv.cc.cc.isGNU or false)) ''
|
||||
configureFlagsArray=(
|
||||
--with-cc-opt="-fPIE -fstack-protector-all --param ssp-buffer-size=4 -O2 -D_FORTIFY_SOURCE=2"
|
||||
--with-ld-opt="-pie -Wl,-z,relro,-z,now"
|
||||
)
|
||||
''
|
||||
;
|
||||
preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules);
|
||||
|
||||
hardeningEnable = [ "pie" ];
|
||||
|
||||
postInstall = ''
|
||||
mv $out/sbin $out/bin
|
||||
|
||||
Reference in New Issue
Block a user