From 15ba4a5cfd13966a54e0b66dafd2f39f3e95ba34 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 16 Nov 2017 17:11:10 +0000 Subject: afl: 2.51b -> 2.52b Fix build with glibc 2.26. Tracking issue: #31696 --- pkgs/tools/security/afl/default.nix | 8 +- .../afl/qemu-patches/qemu-2.3.0-glibc-2.26.patch | 121 +++++++++++++++++++++ pkgs/tools/security/afl/qemu.nix | 1 + 3 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 pkgs/tools/security/afl/qemu-patches/qemu-2.3.0-glibc-2.26.patch (limited to 'pkgs/tools/security/afl') diff --git a/pkgs/tools/security/afl/default.nix b/pkgs/tools/security/afl/default.nix index ae80b5ec0b50..51701590b8e9 100644 --- a/pkgs/tools/security/afl/default.nix +++ b/pkgs/tools/security/afl/default.nix @@ -11,11 +11,11 @@ in stdenv.mkDerivation rec { name = "afl-${version}"; - version = "2.51b"; + version = "2.52b"; src = fetchurl { url = "http://lcamtuf.coredump.cx/afl/releases/${name}.tgz"; - sha256 = "15xvjma2lpawg1wasnja9wmgrpss5mnm3f5xmh5yli5q6m5vjdfl"; + sha256 = "0ig0ij4n1pwry5dw1hk4q88801jzzy2cric6y2gd6560j55lnqa3"; }; # Note: libcgroup isn't needed for building, just for the afl-cgroup @@ -58,6 +58,10 @@ stdenv.mkDerivation rec { done ''; + passthru = { + qemu = afl-qemu; + }; + meta = { description = "Powerful fuzzer via genetic algorithms and instrumentation"; longDescription = '' diff --git a/pkgs/tools/security/afl/qemu-patches/qemu-2.3.0-glibc-2.26.patch b/pkgs/tools/security/afl/qemu-patches/qemu-2.3.0-glibc-2.26.patch new file mode 100644 index 000000000000..1c447c4051e8 --- /dev/null +++ b/pkgs/tools/security/afl/qemu-patches/qemu-2.3.0-glibc-2.26.patch @@ -0,0 +1,121 @@ +diff --git a/user-exec.c b/user-exec.c +index 8f57e8a..957f9f7 100644 +--- a/user-exec.c ++++ b/user-exec.c +@@ -57,7 +57,7 @@ static void exception_action(CPUState *cpu) + void cpu_resume_from_signal(CPUState *cpu, void *puc) + { + #ifdef __linux__ +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + #elif defined(__OpenBSD__) + struct sigcontext *uc = puc; + #endif +@@ -171,7 +171,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + #elif defined(__OpenBSD__) + struct sigcontext *uc = puc; + #else +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + #endif + unsigned long pc; + int trapno; +@@ -226,7 +226,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + #elif defined(__OpenBSD__) + struct sigcontext *uc = puc; + #else +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + #endif + + pc = PC_sig(uc); +@@ -288,7 +288,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + + #ifdef __APPLE__ + #include +-typedef struct ucontext SIGCONTEXT; ++typedef ucontext_t SIGCONTEXT; + /* All Registers access - only for local access */ + #define REG_sig(reg_name, context) \ + ((context)->uc_mcontext->ss.reg_name) +@@ -331,7 +331,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + ucontext_t *uc = puc; + #else +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + #endif + unsigned long pc; + int is_write; +@@ -358,7 +358,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + uint32_t *pc = uc->uc_mcontext.sc_pc; + uint32_t insn = *pc; + int is_write = 0; +@@ -456,7 +456,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + #if defined(__NetBSD__) + ucontext_t *uc = puc; + #else +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + #endif + unsigned long pc; + int is_write; +@@ -483,7 +483,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + int cpu_signal_handler(int host_signum, void *pinfo, void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + uintptr_t pc = uc->uc_mcontext.pc; + uint32_t insn = *(uint32_t *)pc; + bool is_write; +@@ -512,7 +512,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + unsigned long pc; + int is_write; + +@@ -534,7 +534,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + int cpu_signal_handler(int host_signum, void *pinfo, void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + unsigned long ip; + int is_write = 0; + +@@ -565,7 +565,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + unsigned long pc; + uint16_t *pinsn; + int is_write = 0; +@@ -618,7 +618,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + greg_t pc = uc->uc_mcontext.pc; + int is_write; + +@@ -634,7 +634,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, + void *puc) + { + siginfo_t *info = pinfo; +- struct ucontext *uc = puc; ++ ucontext_t *uc = puc; + unsigned long pc = uc->uc_mcontext.sc_iaoq[0]; + uint32_t insn = *(uint32_t *)pc; + int is_write = 0; diff --git a/pkgs/tools/security/afl/qemu.nix b/pkgs/tools/security/afl/qemu.nix index 0e91e2871237..d21500960fec 100644 --- a/pkgs/tools/security/afl/qemu.nix +++ b/pkgs/tools/security/afl/qemu.nix @@ -43,6 +43,7 @@ stdenv.mkDerivation rec { ./qemu-patches/no-etc-install.patch ./qemu-patches/translate-all.patch ./qemu-patches/syscall.patch + ./qemu-patches/qemu-2.3.0-glibc-2.26.patch ]; preConfigure = '' -- cgit 1.4.1