Skip to content
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

graphene-hardened-malloc: init at 190405.003.2019.04.01.19 #59140

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions pkgs/development/libraries/graphene-hardened-malloc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
name = "graphene-hardened-malloc-${version}";
version = "190405.003.2019.04.01.19";

src = fetchurl {
url = "https://github.com/GrapheneOS/hardened_malloc/archive/PQ2A.${version}.tar.gz";
sha256 = "1qczmajy3q07jd236dmal4iq5xxcsrkyw26gc9r4vs4wj4m42d11";
};

installPhase = ''
install -Dm444 -t $out/lib libhardened_malloc.so

mkdir -p $out/bin
substitute preload.sh $out/bin/preload-hardened-malloc --replace "\$dir" $out/lib
chmod 0555 $out/bin/preload-hardened-malloc
'';

doInstallCheck = true;
installCheckPhase = ''
pushd test
make
$out/bin/preload-hardened-malloc ./offset

pushd simple-memory-corruption
make

# these tests don't actually appear to generate overflows currently
rm read_after_free_small string_overflow

for t in `find . -regex ".*/[a-z_]+"` ; do
echo "Running $t..."
# the program being aborted (as it should be) would result in an exit code > 128
(($out/bin/preload-hardened-malloc $t) && false) \
|| (test $? -gt 128 || (echo "$t was not aborted" && false))
done
popd

popd
'';

meta = with stdenv.lib; {
homepage = https://github.com/GrapheneOS/hardened_malloc;
description = "Hardened allocator designed for modern systems";
longDescription = ''
This is a security-focused general purpose memory allocator providing the malloc API
along with various extensions. It provides substantial hardening against heap
corruption vulnerabilities yet aims to provide decent overall performance.
'';
license = licenses.mit;
maintainers = with maintainers; [ ris ];
platforms = platforms.linux;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9003,6 +9003,8 @@ in

grail = callPackage ../development/libraries/grail { };

graphene-hardened-malloc = callPackage ../development/libraries/graphene-hardened-malloc { };

gtk-doc = callPackage ../development/tools/documentation/gtk-doc { };

gtkdialog = callPackage ../development/tools/misc/gtkdialog { };
Expand Down