grsecurity: Add paxctl, paxmark and stdenv.needsPax to stdenv

This commit is contained in:
Ricardo M. Correia 2014-02-17 19:29:43 +01:00
parent 4be7e939a0
commit 8d5ce245a2
3 changed files with 21 additions and 2 deletions

View File

@ -10,6 +10,8 @@ let lib = import ../../../lib; in lib.makeOverridable (
, setupScript ? ./setup.sh , setupScript ? ./setup.sh
, extraBuildInputs ? [] , extraBuildInputs ? []
, skipPaxMarking ? false
}: }:
let let
@ -157,6 +159,9 @@ let
|| system == "armv6l-linux" || system == "armv6l-linux"
|| system == "armv7l-linux"; || system == "armv7l-linux";
# Whether we should run paxctl to pax-mark binaries
needsPax = isLinux && !skipPaxMarking;
# For convenience, bring in the library functions in lib/ so # For convenience, bring in the library functions in lib/ so
# packages don't have to do that themselves. # packages don't have to do that themselves.
inherit lib; inherit lib;

View File

@ -93,6 +93,7 @@ PATH=
for i in $NIX_GCC @initialPath@; do for i in $NIX_GCC @initialPath@; do
if [ "$i" = / ]; then i=; fi if [ "$i" = / ]; then i=; fi
addToSearchPath PATH $i/bin addToSearchPath PATH $i/bin
addToSearchPath PATH $i/sbin
done done
if [ "$NIX_DEBUG" = 1 ]; then if [ "$NIX_DEBUG" = 1 ]; then
@ -293,6 +294,18 @@ stripDirs() {
fi fi
} }
# PaX-mark binaries
paxmark() {
local flags="$1"
shift
if [ -z "@needsPax@" ]; then
return
fi
paxctl -c "$@"
paxctl -zex -${flags} "$@"
}
###################################################################### ######################################################################
# Textual substitution functions. # Textual substitution functions.

View File

@ -210,6 +210,7 @@ rec {
extraAttrs = { extraAttrs = {
glibc = stdenvLinuxGlibc; # Required by gcc47 build glibc = stdenvLinuxGlibc; # Required by gcc47 build
}; };
extraPath = [ stdenvLinuxBoot1Pkgs.paxctl ];
inherit fetchurl; inherit fetchurl;
}; };
@ -268,7 +269,7 @@ rec {
initialPath = initialPath =
((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;}) ((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;})
++ [stdenvLinuxBoot4Pkgs.patchelf]; ++ [stdenvLinuxBoot4Pkgs.patchelf stdenvLinuxBoot4Pkgs.paxctl ];
gcc = wrapGCC rec { gcc = wrapGCC rec {
inherit (stdenvLinuxBoot4Pkgs) binutils coreutils; inherit (stdenvLinuxBoot4Pkgs) binutils coreutils;
@ -295,7 +296,7 @@ rec {
inherit (stdenvLinuxBoot4Pkgs) inherit (stdenvLinuxBoot4Pkgs)
gzip bzip2 xz bash coreutils diffutils findutils gawk gzip bzip2 xz bash coreutils diffutils findutils gawk
gnumake gnused gnutar gnugrep gnupatch patchelf gnumake gnused gnutar gnugrep gnupatch patchelf
attr acl; attr acl paxctl;
}; };
}; };