afl: 2.52b -> 2.56b

can remove qemu glibc patch as it is now covered by afl's own patches
This commit is contained in:
Robert Scott 2019-12-21 13:50:23 +00:00 committed by Austin Seipp
parent 21958c0603
commit de0e71780c
5 changed files with 19 additions and 45 deletions

View File

@ -4,12 +4,12 @@ Updating the QEMU patches
When updating to the latest American Fuzzy Lop, make sure to check for
any new patches to qemu for binary fuzzing support:
https://github.com/mirrorer/afl/tree/master/qemu_mode
https://github.com/google/AFL/tree/master/qemu_mode
Be sure to check the build script and make sure it's also using the
right QEMU version and options in `qemu.nix`:
https://github.com/mirrorer/afl/blob/master/qemu_mode/build_qemu_support.sh
https://github.com/google/AFL/blob/master/qemu_mode/build_qemu_support.sh
`afl-config.h`, `afl-types.h`, and `afl-qemu-cpu-inl.h` are part of
the afl source code, and copied from `config.h`, `types.h` and

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, callPackage, makeWrapper
{ stdenv, fetchFromGitHub, callPackage, makeWrapper
, clang, llvm, which, libcgroup
}:
@ -9,11 +9,13 @@ let
else throw "afl: no support for ${stdenv.hostPlatform.system}!";
afl = stdenv.mkDerivation rec {
pname = "afl";
version = "2.52b";
version = "2.56b";
src = fetchurl {
url = "http://lcamtuf.coredump.cx/afl/releases/${pname}-${version}.tgz";
sha256 = "0ig0ij4n1pwry5dw1hk4q88801jzzy2cric6y2gd6560j55lnqa3";
src = fetchFromGitHub {
owner = "google";
repo = pname;
rev = "v${version}";
sha256 = "1q1g59gkm48aa4cg9h70jx4i2gapmypgp5rzs156b2avd95vwkn1";
};
enableParallelBuilding = true;

View File

@ -5,7 +5,7 @@ stdenv.mkDerivation {
pname = "libdislocator";
src = afl.src;
sourceRoot = "${afl.name}/libdislocator";
sourceRoot = "${afl.src.name}/libdislocator";
makeFlags = [ "PREFIX=$(out)" ];

View File

@ -1,28 +0,0 @@
A modified version of qemu commit 75e5b70e6b5dcc4f2219992d7cffa462aa406af0
diff --git a/configure b/configure
index 9c8aa5a..99ccc17 100755
--- a/configure
+++ b/configure
@@ -3855,7 +3855,7 @@ fi
# check if memfd is supported
memfd=no
cat > $TMPC << EOF
-#include <sys/memfd.h>
+#include <sys/mman.h>
int main(void)
{
diff --git a/util/memfd.c b/util/memfd.c
index 4571d1a..412e94a 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -31,9 +31,7 @@
#include "qemu/memfd.h"
-#ifdef CONFIG_MEMFD
-#include <sys/memfd.h>
-#elif defined CONFIG_LINUX
+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
#include <sys/syscall.h>
#include <asm/unistd.h>

View File

@ -6,7 +6,6 @@ with stdenv.lib;
let
qemuName = "qemu-2.10.0";
aflName = afl.name;
cpuTarget = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64-linux-user"
else if stdenv.hostPlatform.system == "i686-linux" then "i386-linux-user"
else throw "afl: no support for ${stdenv.hostPlatform.system}!";
@ -25,12 +24,12 @@ stdenv.mkDerivation {
sourceRoot = qemuName;
postUnpack = ''
cp ${aflName}/types.h $sourceRoot/afl-types.h
substitute ${aflName}/config.h $sourceRoot/afl-config.h \
cp ${afl.src.name}/types.h $sourceRoot/afl-types.h
substitute ${afl.src.name}/config.h $sourceRoot/afl-config.h \
--replace "types.h" "afl-types.h"
substitute ${aflName}/qemu_mode/patches/afl-qemu-cpu-inl.h $sourceRoot/afl-qemu-cpu-inl.h \
substitute ${afl.src.name}/qemu_mode/patches/afl-qemu-cpu-inl.h $sourceRoot/afl-qemu-cpu-inl.h \
--replace "../../config.h" "afl-config.h"
substituteInPlace ${aflName}/qemu_mode/patches/cpu-exec.diff \
substituteInPlace ${afl.src.name}/qemu_mode/patches/cpu-exec.diff \
--replace "../patches/afl-qemu-cpu-inl.h" "afl-qemu-cpu-inl.h"
'';
@ -46,12 +45,13 @@ stdenv.mkDerivation {
patches = [
# patches extracted from afl source
"../${aflName}/qemu_mode/patches/cpu-exec.diff"
"../${aflName}/qemu_mode/patches/elfload.diff"
"../${aflName}/qemu_mode/patches/syscall.diff"
"../${afl.src.name}/qemu_mode/patches/cpu-exec.diff"
"../${afl.src.name}/qemu_mode/patches/elfload.diff"
"../${afl.src.name}/qemu_mode/patches/syscall.diff"
"../${afl.src.name}/qemu_mode/patches/configure.diff"
"../${afl.src.name}/qemu_mode/patches/memfd.diff"
# nix-specific patches to make installation more well-behaved
./qemu-patches/no-etc-install.patch
./qemu-patches/qemu-2.10.0-glibc-2.27.patch
];
configureFlags =