diff options
author | Robert Scott <code@humanleg.org.uk> | 2019-12-29 01:52:31 +0000 |
---|---|---|
committer | Robert Scott <code@humanleg.org.uk> | 2020-04-18 19:52:11 +0100 |
commit | fbc11b4f025d95f1b3116ec4b594c0e558f46e90 (patch) | |
tree | a33f611d1255c3c342b1925d29bfc273fc44e03a /pkgs/tools/security/aflplusplus/qemu.nix | |
parent | cd3bc38f40db28c16e631825a0adf6f21e80b88c (diff) | |
download | nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.tar nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.tar.gz nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.tar.bz2 nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.tar.lz nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.tar.xz nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.tar.zst nixlib-fbc11b4f025d95f1b3116ec4b594c0e558f46e90.zip |
aflplusplus: init at 2.59c
Diffstat (limited to 'pkgs/tools/security/aflplusplus/qemu.nix')
-rw-r--r-- | pkgs/tools/security/aflplusplus/qemu.nix | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/pkgs/tools/security/aflplusplus/qemu.nix b/pkgs/tools/security/aflplusplus/qemu.nix new file mode 100644 index 000000000000..202657dac9ae --- /dev/null +++ b/pkgs/tools/security/aflplusplus/qemu.nix @@ -0,0 +1,77 @@ +{ stdenv, fetchurl, aflplusplus, python2, zlib, pkgconfig, glib, perl +, texinfo, libuuid, flex, bison, pixman, autoconf +}: + +with stdenv.lib; + +let + qemuName = "qemu-3.1.0"; + cpuTarget = if stdenv.targetPlatform.system == "x86_64-linux" then "x86_64-linux-user" + else if stdenv.targetPlatform.system == "i686-linux" then "i386-linux-user" + else throw "aflplusplus: no support for ${stdenv.targetPlatform.system}!"; +in +stdenv.mkDerivation { + name = "aflplusplus-${qemuName}"; + + srcs = [ + (fetchurl { + url = "http://wiki.qemu.org/download/${qemuName}.tar.bz2"; + sha256 = "08frr1fdjx8qcfh3fafn10kibdwbvkqqvfl7hpqbm7i9dg4f1zlq"; + }) + aflplusplus.src + ]; + + sourceRoot = qemuName; + + postUnpack = '' + chmod -R +w ${aflplusplus.src.name} + for f in ${aflplusplus.src.name}/qemu_mode/patches/* ; do + sed -E -i 's|(\.\./)+patches/([a-z-]+\.h)|\2|g' $f + sed -E -i 's|\.\./\.\./config\.h|afl-config.h|g' $f + done + cp ${aflplusplus.src.name}/qemu_mode/patches/*.h $sourceRoot/ + cp ${aflplusplus.src.name}/types.h $sourceRoot/afl-types.h + substitute ${aflplusplus.src.name}/config.h $sourceRoot/afl-config.h \ + --replace "types.h" "afl-types.h" + + cat ${aflplusplus.src.name}/qemu_mode/patches/*.diff > all.patch + ''; + + nativeBuildInputs = [ + python2 perl pkgconfig flex bison autoconf texinfo + ]; + + buildInputs = [ + zlib glib pixman libuuid + ]; + + enableParallelBuilding = true; + + patches = [ + # patches extracted from aflplusplus source + "../all.patch" + # nix-specific patches to make installation more well-behaved + ./qemu-no-etc-install.patch + ]; + + configureFlags = + [ "--disable-system" + "--enable-linux-user" + "--disable-gtk" + "--disable-sdl" + "--disable-vnc" + "--disable-kvm" + "--target-list=${cpuTarget}" + "--enable-pie" + "--sysconfdir=/etc" + "--localstatedir=/var" + ]; + + meta = with stdenv.lib; { + homepage = http://www.qemu.org/; + description = "Fork of QEMU with AFL++ instrumentation support"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ ris ]; + platforms = platforms.linux; + }; +} |