1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016 Eric Bavier <bavier@member.fsf.org>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages debug)
20 #:use-module (guix packages)
21 #:use-module (guix licenses)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix utils)
25 #:use-module (guix build-system gnu)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages bash)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages golang)
31 #:use-module (gnu packages indent)
32 #:use-module (gnu packages llvm)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages pretty-print)
35 #:use-module (gnu packages qemu)
36 #:use-module (ice-9 match)
37 #:use-module (srfi srfi-1))
42 (version "2006.08.03")
47 (string-append "http://ftp.de.debian.org/debian/pool/main/d/delta/"
48 "delta_" version ".orig.tar.gz")
49 ;; This uri seems to send guix download into an infinite loop
50 (string-append "http://delta.tigris.org/files/documents/3103/"
51 "33566/delta-" version ".tar.gz")))
54 "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q"))))
55 (build-system gnu-build-system)
56 (inputs ;Installed programs are perl scripts
62 (lambda* (#:key outputs #:allow-other-keys)
63 ;; Makefile contains no install target
64 (let* ((out (assoc-ref outputs "out"))
65 (bin (string-append out "/bin"))
66 (doc (string-append out "/share/doc/delta-" ,version)))
71 (copy-file h (string-append doc "/" (basename h))))
72 `("License.txt" ,@(find-files "www" ".*\\.html")))
74 (copy-file b (string-append bin "/" b)))
75 `("delta" "multidelta" "topformflat")))))
76 (alist-delete 'configure %standard-phases))))
77 (home-page "http://delta.tigris.org/")
78 (synopsis "Heuristical file minimizer")
80 "Delta assists you in minimizing \"interesting\" files subject to a test
81 of their interestingness. A common such situation is when attempting to
82 isolate a small failure-inducing substring of a large input that causes your
83 program to exhibit a bug.")
84 ;; See License.txt, which is a bsd-3 license, despite the project's
85 ;; home-page pointing to a bsd-2 license.
88 (define-public c-reduce
96 (string-append "http://embed.cs.utah.edu/creduce/"
97 "creduce-" version ".tar.gz")))
100 "1r23lhzq3dz8vi2dalxk5las8bf0av2w94hxxbs61pr73m77ik9d"))))
101 (build-system gnu-build-system)
109 ("exporter-lite" ,perl-exporter-lite)
110 ("file-which" ,perl-file-which)
111 ("getopt-tabular" ,perl-getopt-tabular)
112 ("regex-common" ,perl-regexp-common)
113 ("sys-cpu" ,perl-sys-cpu)
114 ("term-readkey" ,perl-term-readkey)))
116 `(#:phases (alist-cons-after
117 'install 'set-load-paths
118 (lambda* (#:key inputs outputs #:allow-other-keys)
119 ;; Tell creduce where to find the perl modules it needs.
120 (let* ((out (assoc-ref outputs "out"))
121 (prog (string-append out "/bin/creduce")))
124 `("PERL5LIB" ":" prefix
126 (string-append (assoc-ref inputs p)
127 "/lib/perl5/site_perl/"
128 ,(package-version perl)))
129 '("term-readkey" "exporter-lite"
130 "file-which" "getopt-tabular"
131 "regex-common" "sys-cpu"))))))
133 (home-page "http://embed.cs.utah.edu/creduce")
134 (synopsis "Reducer for interesting code")
136 "C-Reduce is a tool that takes a large C or C++ program that has a
137 property of interest (such as triggering a compiler bug) and automatically
138 produces a much smaller C/C++ program that has the same property. It is
139 intended for use by people who discover and report bugs in compilers and other
140 tools that process C/C++ code.")
145 (inherit qemu-minimal)
150 "http://wiki.qemu-project.org/download/qemu-"
154 "120m53c3p28qxmfzllicjzr8syjv6v4d9rsyrgkp7gnmcgvvgfmn"))))
156 ;; XXX: Disable tests because of GTester's rejection of duplicate test
157 ;; names, which wasn't addressed in this version of QEMU.
159 ,@(substitute-keyword-arguments (package-arguments qemu-minimal)
161 ;; We disable the tests so we skip the phase disabling the qga test.
162 `(modify-phases ,phases (delete 'disable-test-qga))))))))
164 (define-public american-fuzzy-lop
165 (let ((machine (match (or (%current-target-system)
167 ("x86_64-linux" "x86_64")
168 ("i686-linux" "i386")
169 ;; Prevent errors when querying this package on unsupported
170 ;; platforms, e.g. when running "guix package --search="
173 (name "american-fuzzy-lop")
174 (version "2.15b") ;It seems all releases have the 'b' suffix
178 (uri (string-append "http://lcamtuf.coredump.cx/afl/releases/"
179 "afl-" version ".tgz"))
182 "04n2jfkchpz6a07w694b0im1vcmc3220ryqcaasa7vix7784wzs2"))))
183 (build-system gnu-build-system)
186 ;; The afl-qemu tool builds qemu 2.3.0 with a few patches applied.
187 ,(package (inherit qemu-2.3.0)
190 `(("afl-src" ,source)
191 ,@(package-inputs qemu-2.3.0)))
192 ;; afl only supports using a single afl-qemu-trace executable, so
193 ;; we only build qemu for the native target.
195 `(#:modules ((srfi srfi-1)
196 ,@%gnu-build-system-modules)
197 ,@(substitute-keyword-arguments (package-arguments qemu-2.3.0)
198 ((#:configure-flags config-flags)
199 ``(,(string-append "--target-list=" ,machine "-linux-user")
200 ,@(remove (λ (f) (string-prefix? "--target-list=" f))
202 ((#:phases qemu-phases)
203 `(modify-phases ,qemu-phases
205 'unpack 'apply-afl-patches
206 (lambda* (#:key inputs #:allow-other-keys)
207 (let* ((afl-dir (string-append "afl-" ,version))
209 (string-append afl-dir
210 "/qemu_mode/patches")))
213 (assoc-ref inputs "afl-src")))
214 (error "tar failed to unpack afl-src"))
215 (copy-file (string-append patch-dir
216 "/afl-qemu-cpu-inl.h")
217 "./afl-qemu-cpu-inl.h")
218 (copy-file (string-append afl-dir "/config.h")
220 (copy-file (string-append afl-dir "/types.h")
222 (substitute* "afl-qemu-cpu-inl.h"
223 (("\\.\\./\\.\\./config.h") "afl-config.h"))
224 (substitute* (string-append patch-dir
226 (("\\.\\./patches/") ""))
227 (every (lambda (patch-file)
228 (zero? (system* "patch" "--force" "-p1"
229 "--input" patch-file)))
230 (find-files patch-dir
231 "\\.diff$"))))))))))))))
233 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
235 #:phases (modify-phases %standard-phases
238 ;; TODO: Build and install the afl-llvm tool.
239 'install 'install-qemu
240 (lambda* (#:key inputs outputs #:allow-other-keys)
241 (let ((qemu (assoc-ref inputs "custom-qemu"))
242 (out (assoc-ref outputs "out")))
243 (symlink (string-append qemu "/bin/qemu-" ,machine)
244 (string-append out "/bin/afl-qemu-trace"))
247 (supported-systems (fold delete
249 '("armhf-linux" "mips64el-linux")))
250 (home-page "http://lcamtuf.coredump.cx/afl")
251 (synopsis "Security-oriented fuzzer")
253 "American fuzzy lop is a security-oriented fuzzer that employs a novel
254 type of compile-time instrumentation and genetic algorithms to automatically
255 discover clean, interesting test cases that trigger new internal states in the
256 targeted binary. This substantially improves the functional coverage for the
257 fuzzed code. The compact synthesized corpora produced by the tool are also
258 useful for seeding other, more labor- or resource-intensive testing regimes
262 (define-public stress-make
263 (let ((commit "506e6cfd98d165f22bee91c408b7c20117a682c4")
264 (revision "0")) ;No official source distribution
267 (version (string-append "1.0-" revision "." (string-take commit 7)))
272 (url "https://github.com/losalamos/stress-make.git")
274 (file-name (string-append name "-" version "-checkout"))
277 "1j330yqhc7plwin04qxbh8afpg5nfnw1xvnmh8rk6mmqg9w6ik70"))))
278 (build-system gnu-build-system)
280 `(("autoconf" ,autoconf)
281 ("automake" ,automake)
284 `(("make-source" ,(package-source gnu-make))))
286 ;; stress-make's configure script insists on having a tarball and does
287 ;; not accept a directory name instead. To let the gnu-build-system's
288 ;; patch-* phases work properly, we unpack the source first, then
289 ;; repack before the configure phase.
290 `(#:configure-flags '("--with-make-tar=./make.tar.xz")
292 (modify-phases %standard-phases
293 (add-after 'unpack 'unpack-make
294 (lambda* (#:key inputs #:allow-other-keys)
295 (zero? (system* "tar" "xf" (assoc-ref inputs "make-source")))))
296 (add-before 'configure 'repack-make
298 (zero? (system* "tar" "cJf" "./make.tar.xz"
299 (string-append "make-"
300 ,(package-version gnu-make))))))
301 (add-before 'configure 'bootstrap
303 (zero? (system* "autoreconf" "-vfi")))))))
304 (home-page "https://github.com/losalamos/stress-make")
305 (synopsis "Expose race conditions in Makefiles")
307 "Stress Make is a customized GNU Make that explicitely managess the
308 order in which concurrent jobs are run in order to provoke erroneous behavior
309 into becoming manifest. It can run jobs in the order they're launched, in
310 backwards order, or in random order. The thought is that if code builds
311 correctly with Stress Make then it is likely that the @code{Makefile} contains
312 no race conditions.")
313 ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated,
314 ;; and patched GNU Make is under its own license.
315 (license (list (non-copyleft "COPYING.md")
316 (package-license gnu-make))))))
326 "https://github.com/samhocevar/zzuf/releases/download/v"
327 version "/" name "-" version ".tar.gz"))
328 (file-name (string-append name "-" version ".tar.gz"))
331 "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3"))))
332 (build-system gnu-build-system)
333 (home-page "https://github.com/samhocevar/zzuf")
334 (synopsis "Transparent application input fuzzer")
335 (description "Zzuf is a transparent application input fuzzer. It works by
336 intercepting file operations and changing random bits in the program's
337 input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
338 (license (non-copyleft "http://www.wtfpl.net/txt/copying/"))))