1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016, 2017 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com>
6 ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages debug)
24 #:use-module (guix packages)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix utils)
29 #:use-module (guix build-system gnu)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bash)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages golang)
37 #:use-module (gnu packages code)
38 #:use-module (gnu packages llvm)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages pretty-print)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages readline)
43 #:use-module (gnu packages virtualization)
44 #:use-module (ice-9 match)
45 #:use-module (srfi srfi-1))
50 (version "2006.08.03")
55 (string-append "http://ftp.de.debian.org/debian/pool/main/d/delta/"
56 "delta_" version ".orig.tar.gz")
57 ;; This uri seems to send guix download into an infinite loop
58 (string-append "http://delta.tigris.org/files/documents/3103/"
59 "33566/delta-" version ".tar.gz")))
62 "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q"))))
63 (build-system gnu-build-system)
64 (inputs ;Installed programs are perl scripts
68 (modify-phases %standard-phases
70 (lambda* (#:key outputs #:allow-other-keys)
71 ;; Makefile contains no install target
72 (let* ((out (assoc-ref outputs "out"))
73 (bin (string-append out "/bin"))
74 (doc (string-append out "/share/doc/delta-" ,version)))
78 `("License.txt" ,@(find-files "www" ".*\\.html")))
81 `("delta" "multidelta" "topformflat"))))
83 (delete 'configure)))) ; no configure script
84 (home-page "http://delta.tigris.org/")
85 (synopsis "Heuristical file minimizer")
87 "Delta assists you in minimizing \"interesting\" files subject to a test
88 of their interestingness. A common such situation is when attempting to
89 isolate a small failure-inducing substring of a large input that causes your
90 program to exhibit a bug.")
91 ;; See License.txt, which is a bsd-3 license, despite the project's
92 ;; home-page pointing to a bsd-2 license.
95 ;; Newer versions depend on LLVM and Clang >= 4, which have yet to be packaged.
96 (define-public c-reduce
104 (string-append "http://embed.cs.utah.edu/creduce/"
105 "creduce-" version ".tar.gz")))
108 "0pf5q0n8vkdcr1wrkxn2jzxv0xkrir13bwmqfw3jpbm3dh2c3b6d"))))
109 (build-system gnu-build-system)
113 ("clang" ,clang-3.9.1)
117 ("exporter-lite" ,perl-exporter-lite)
118 ("file-which" ,perl-file-which)
119 ("getopt-tabular" ,perl-getopt-tabular)
120 ("regex-common" ,perl-regexp-common)
121 ("sys-cpu" ,perl-sys-cpu)
122 ("term-readkey" ,perl-term-readkey)))
125 (modify-phases %standard-phases
126 (add-after 'install 'set-load-paths
127 (lambda* (#:key inputs outputs #:allow-other-keys)
128 ;; Tell creduce where to find the perl modules it needs.
129 (let* ((out (assoc-ref outputs "out"))
130 (prog (string-append out "/bin/creduce")))
133 `("PERL5LIB" ":" prefix
135 (string-append (assoc-ref inputs p)
136 "/lib/perl5/site_perl/"
137 ,(package-version perl)))
138 '("term-readkey" "exporter-lite"
139 "file-which" "getopt-tabular"
140 "regex-common" "sys-cpu")))))
142 (home-page "https://embed.cs.utah.edu/creduce")
143 (synopsis "Reducer for interesting code")
145 "C-Reduce is a tool that takes a large C or C++ program that has a
146 property of interest (such as triggering a compiler bug) and automatically
147 produces a much smaller C/C++ program that has the same property. It is
148 intended for use by people who discover and report bugs in compilers and other
149 tools that process C/C++ code.")
152 (define-public american-fuzzy-lop
153 (let ((machine (match (or (%current-target-system)
155 ("x86_64-linux" "x86_64")
156 ("i686-linux" "i386")
157 ("aarch64-linux" "aarch64")
158 ("armhf-linux" "arm")
159 ("mips64el-linux" "mips64el")
160 ;; Prevent errors when querying this package on unsupported
161 ;; platforms, e.g. when running "guix package --search="
164 (name "american-fuzzy-lop")
165 (version "2.52b") ;It seems all releases have the 'b' suffix
169 (uri (string-append "http://lcamtuf.coredump.cx/afl/releases/"
170 "afl-" version ".tgz"))
173 "0ig0ij4n1pwry5dw1hk4q88801jzzy2cric6y2gd6560j55lnqa3"))))
174 (build-system gnu-build-system)
177 ;; The afl-qemu tool builds qemu 2.10.0 with a few patches applied.
178 ,(package (inherit qemu-minimal-2.10)
181 `(("afl-src" ,source)
182 ,@(package-inputs qemu-minimal)))
183 ;; afl only supports using a single afl-qemu-trace executable, so
184 ;; we only build qemu for the native target.
186 `(#:modules ((srfi srfi-1)
187 ,@%gnu-build-system-modules)
188 ,@(substitute-keyword-arguments (package-arguments qemu-minimal)
189 ((#:configure-flags config-flags)
190 ``(,(string-append "--target-list=" ,machine "-linux-user")
191 ,@(remove (λ (f) (string-prefix? "--target-list=" f))
193 ((#:phases qemu-phases)
194 `(modify-phases ,qemu-phases
196 'unpack 'apply-afl-patches
197 (lambda* (#:key inputs #:allow-other-keys)
198 (let* ((afl-dir (string-append "afl-" ,version))
200 (string-append afl-dir
201 "/qemu_mode/patches")))
203 (assoc-ref inputs "afl-src"))
204 (install-file (string-append patch-dir
205 "/afl-qemu-cpu-inl.h")
207 (copy-file (string-append afl-dir "/config.h")
209 (install-file (string-append afl-dir "/types.h")
211 (substitute* "afl-qemu-cpu-inl.h"
212 (("\\.\\./\\.\\./config.h") "afl-config.h"))
213 (substitute* (string-append patch-dir
215 (("\\.\\./patches/") ""))
216 (for-each (lambda (patch-file)
217 (invoke "patch" "--force" "-p1"
218 "--input" patch-file))
219 (find-files patch-dir
223 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
225 #:phases (modify-phases %standard-phases
227 ,@(if (string=? (%current-system) (or "x86_64-linux"
230 '((add-before 'build 'set-afl-flag
231 (lambda _ (setenv "AFL_NO_X86" "1") #t))
232 (add-after 'install 'remove-x86-programs
233 (lambda* (#:key outputs #:allow-other-keys)
234 (let* ((out (assoc-ref outputs "out"))
235 (bin (string-append out "/bin/")))
236 (delete-file (string-append bin "afl-gcc"))
237 (delete-file (string-append bin "afl-g++"))
238 (delete-file (string-append bin "afl-clang"))
239 (delete-file (string-append bin "afl-clang++")))
242 ;; TODO: Build and install the afl-llvm tool.
243 'install 'install-qemu
244 (lambda* (#:key inputs outputs #:allow-other-keys)
245 (let ((qemu (assoc-ref inputs "custom-qemu"))
246 (out (assoc-ref outputs "out")))
247 (symlink (string-append qemu "/bin/qemu-" ,machine)
248 (string-append out "/bin/afl-qemu-trace"))
250 (delete 'check)))) ; Tests are run during 'install phase.
251 (home-page "http://lcamtuf.coredump.cx/afl")
252 (synopsis "Security-oriented fuzzer")
254 "American fuzzy lop is a security-oriented fuzzer that employs a novel
255 type of compile-time instrumentation and genetic algorithms to automatically
256 discover clean, interesting test cases that trigger new internal states in the
257 targeted binary. This substantially improves the functional coverage for the
258 fuzzed code. The compact synthesized corpora produced by the tool are also
259 useful for seeding other, more labor- or resource-intensive testing regimes
263 (define-public stress-make
264 (let ((commit "506e6cfd98d165f22bee91c408b7c20117a682c4")
265 (revision "0")) ;No official source distribution
268 (version (string-append "1.0-" revision "." (string-take commit 7)))
273 (url "https://github.com/losalamos/stress-make.git")
275 (file-name (string-append name "-" version "-checkout"))
278 "1j330yqhc7plwin04qxbh8afpg5nfnw1xvnmh8rk6mmqg9w6ik70"))))
279 (build-system gnu-build-system)
281 `(("autoconf" ,autoconf)
282 ("automake" ,automake)
285 `(("make-source" ,(package-source gnu-make))))
287 ;; stress-make's configure script insists on having a tarball and does
288 ;; not accept a directory name instead. To let the gnu-build-system's
289 ;; patch-* phases work properly, we unpack the source first, then
290 ;; repack before the configure phase.
291 (let ((make-dir (string-append "make-" (package-version gnu-make))))
292 `(#:configure-flags '("--with-make-tar=./make.tar.xz"
293 "make_cv_sys_gnu_glob=yes")
295 (modify-phases %standard-phases
296 (add-after 'unpack 'unpack-make
297 (lambda* (#:key inputs #:allow-other-keys)
298 (invoke "tar" "xf" (assoc-ref inputs "make-source"))))
299 (add-after 'unpack-make 'set-default-shell
301 ;; Taken mostly directly from (@ (gnu packages base) gnu-make)
302 (substitute* (string-append ,make-dir "/job.c")
303 (("default_shell = .*$")
304 (format #f "default_shell = \"~a\";\n"
306 (add-before 'configure 'repack-make
308 (invoke "tar" "cJf" "./make.tar.xz" ,make-dir)))))))
309 (home-page "https://github.com/losalamos/stress-make")
310 (synopsis "Expose race conditions in Makefiles")
312 "Stress Make is a customized GNU Make that explicitely manages the order
313 in which concurrent jobs are run to provoke erroneous behavior into becoming
314 manifest. It can run jobs in the order in which they're launched, in backwards
315 order, or in random order. The thought is that if code builds correctly with
316 Stress Make, then it is likely that the @code{Makefile} contains no race
318 ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated,
319 ;; and patched GNU Make is under its own license.
320 (license (list (non-copyleft "COPYING.md")
321 (package-license gnu-make))))))
331 "https://github.com/samhocevar/zzuf/releases/download/v"
332 version "/" name "-" version ".tar.gz"))
333 (file-name (string-append name "-" version ".tar.gz"))
336 "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3"))))
337 (build-system gnu-build-system)
338 (home-page "https://github.com/samhocevar/zzuf")
339 (synopsis "Transparent application input fuzzer")
340 (description "Zzuf is a transparent application input fuzzer. It works by
341 intercepting file operations and changing random bits in the program's
342 input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
343 (license (non-copyleft "http://www.wtfpl.net/txt/copying/"))))
345 (define-public scanmem
353 (url "https://github.com/scanmem/scanmem")
354 (commit (string-append "v" version))))
355 (file-name (git-file-name name version))
358 "17p8sh0rj8yqz36ria5bp48c8523zzw3y9g8sbm2jwq7sc27i7s9"))))
359 (build-system gnu-build-system)
361 `(#:configure-flags '("--enable-gui")
363 (modify-phases %standard-phases
364 (add-before 'configure 'hardcode-python
365 (lambda* (#:key inputs outputs #:allow-other-keys)
366 (substitute* "gui/GameConqueror.py"
367 (("/usr/bin/env python")
368 (string-append (assoc-ref %build-inputs
369 "python-wrapper") "/bin/python")))
371 (add-after 'install 'wrap-gameconqueror
372 (lambda* (#:key inputs outputs #:allow-other-keys)
373 (let ((out (assoc-ref outputs "out"))
374 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
375 (python-path (getenv "PYTHONPATH")))
376 (wrap-program (string-append out "/share/gameconqueror/GameConqueror.py")
377 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
378 `("PYTHONPATH" ":" prefix (,python-path))))
381 `(("libtool" ,libtool)
382 ("python-wrapper" ,python-wrapper)
383 ("gobject-introspection" ,gobject-introspection)
385 ("intltool" ,intltool)
386 ("automake" ,automake)
387 ("autoconf" ,autoconf)))
389 `(("readline" ,readline)))
391 `(("python-pygobject" ,python-pygobject)))
392 (home-page "https://github.com/scanmem/scanmem")
393 (synopsis "Memory scanner")
394 (description "Scanmem is a debugging utility designed to isolate the
395 address of an arbitrary variable in an executing process. Scanmem simply
396 needs to be told the pid of the process and the value of the variable at
397 several different times. After several scans of the process, scanmem isolates
398 the position of the variable and allows you to modify its value.")
399 ;; The library is covered by LGPLv3 or later; the application is covered
400 ;; by GPLv3 or later.
401 (license (list lgpl3+ gpl3+))))