diff --git a/pkgs/tools/security/aflplusplus/default.nix b/pkgs/tools/security/aflplusplus/default.nix index 09d2d20d0faf..3f436d650a3f 100644 --- a/pkgs/tools/security/aflplusplus/default.nix +++ b/pkgs/tools/security/aflplusplus/default.nix @@ -1,8 +1,22 @@ -{ lib, stdenv, stdenvNoCC, fetchFromGitHub, callPackage, makeWrapper -, clang, llvm, gcc, which, libcgroup, python3, perl, gmp -, file, wine ? null -, cmocka -, llvmPackages +{ + lib, + stdenv, + stdenvNoCC, + fetchFromGitHub, + callPackage, + makeWrapper, + clang, + llvm, + gcc, + which, + libcgroup, + python3, + perl, + gmp, + file, + wine ? null, + cmocka, + llvmPackages, }: # wine fuzzing is only known to work for win32 binaries, and using a mixture of @@ -12,9 +26,13 @@ assert (wine != null) -> (stdenv.targetPlatform.system == "i686-linux"); let aflplusplus-qemu = callPackage ./qemu.nix { }; - qemu-exe-name = if stdenv.targetPlatform.system == "x86_64-linux" then "qemu-x86_64" - else if stdenv.targetPlatform.system == "i686-linux" then "qemu-i386" - else throw "aflplusplus: no support for ${stdenv.targetPlatform.system}!"; + qemu-exe-name = + if stdenv.targetPlatform.system == "x86_64-linux" then + "qemu-x86_64" + else if stdenv.targetPlatform.system == "i686-linux" then + "qemu-i386" + else + throw "aflplusplus: no support for ${stdenv.targetPlatform.system}!"; libdislocator = callPackage ./libdislocator.nix { inherit aflplusplus; }; libtokencap = callPackage ./libtokencap.nix { inherit aflplusplus; }; aflplusplus = stdenvNoCC.mkDerivation rec { @@ -32,9 +50,18 @@ let # Note: libcgroup isn't needed for building, just for the afl-cgroup # script. - nativeBuildInputs = [ makeWrapper which clang gcc ]; - buildInputs = [ llvm python3 gmp llvmPackages.bintools ] - ++ lib.optional (wine != null) python3.pkgs.wrapPython; + nativeBuildInputs = [ + makeWrapper + which + clang + gcc + ]; + buildInputs = [ + llvm + python3 + gmp + llvmPackages.bintools + ] ++ lib.optional (wine != null) python3.pkgs.wrapPython; # Flag is already set by package and causes some compiler warnings. # warning: "_FORTIFY_SOURCE" redefined @@ -88,50 +115,56 @@ let runHook postBuild ''; - postInstall = '' - # remove afl-clang(++) which are just symlinks to afl-clang-fast - rm $out/bin/afl-clang $out/bin/afl-clang++ + postInstall = + '' + # remove afl-clang(++) which are just symlinks to afl-clang-fast + rm $out/bin/afl-clang $out/bin/afl-clang++ - # the makefile neglects to install unsigaction - cp qemu_mode/unsigaction/unsigaction*.so $out/lib/afl/ + # the makefile neglects to install unsigaction + cp qemu_mode/unsigaction/unsigaction*.so $out/lib/afl/ - # Install the custom QEMU emulator for binary blob fuzzing. - ln -s ${aflplusplus-qemu}/bin/${qemu-exe-name} $out/bin/afl-qemu-trace + # Install the custom QEMU emulator for binary blob fuzzing. + ln -s ${aflplusplus-qemu}/bin/${qemu-exe-name} $out/bin/afl-qemu-trace - # give user a convenient way of accessing libcompconv.so, libdislocator.so, libtokencap.so - cat > $out/bin/get-afl-qemu-libcompcov-so < $out/bin/get-afl-qemu-libcompcov-so <