Commit | Line | Data |
---|---|---|
8d809faf | 1 | ;;; GNU Guix --- Functional package management for GNU |
a6de569e | 2 | ;;; Copyright © 2014, 2015, 2016, 2017, 2019 Eric Bavier <bavier@member.fsf.org> |
7746af66 | 3 | ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il> |
2b30af95 | 4 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
f20c64ed | 5 | ;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com> |
a778f270 | 6 | ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com> |
8d809faf EB |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
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. | |
14 | ;;; | |
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. | |
19 | ;;; | |
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/>. | |
22 | ||
23 | (define-module (gnu packages debug) | |
24 | #:use-module (guix packages) | |
25 | #:use-module (guix licenses) | |
26 | #:use-module (guix download) | |
b718bef0 | 27 | #:use-module (guix git-download) |
426fde9a | 28 | #:use-module (guix utils) |
8d809faf | 29 | #:use-module (guix build-system gnu) |
b718bef0 EB |
30 | #:use-module (gnu packages autotools) |
31 | #:use-module (gnu packages base) | |
426fde9a EB |
32 | #:use-module (gnu packages bash) |
33 | #:use-module (gnu packages flex) | |
a778f270 | 34 | #:use-module (gnu packages glib) |
f20c64ed | 35 | #:use-module (gnu packages gtk) |
b718bef0 | 36 | #:use-module (gnu packages golang) |
6c7d0620 | 37 | #:use-module (gnu packages code) |
426fde9a EB |
38 | #:use-module (gnu packages llvm) |
39 | #:use-module (gnu packages perl) | |
9b459fc7 | 40 | #:use-module (gnu packages pretty-print) |
f20c64ed | 41 | #:use-module (gnu packages python) |
a778f270 | 42 | #:use-module (gnu packages readline) |
59132b80 | 43 | #:use-module (gnu packages virtualization) |
9b459fc7 EB |
44 | #:use-module (ice-9 match) |
45 | #:use-module (srfi srfi-1)) | |
8d809faf EB |
46 | |
47 | (define-public delta | |
48 | (package | |
49 | (name "delta") | |
50 | (version "2006.08.03") | |
51 | (source | |
52 | (origin | |
53 | (method url-fetch) | |
54 | (uri (list | |
efd63d02 | 55 | (string-append "mirror://debian/pool/main/d/delta/" |
8d809faf EB |
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"))) | |
60 | (sha256 | |
61 | (base32 | |
62 | "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q")))) | |
63 | (build-system gnu-build-system) | |
64 | (inputs ;Installed programs are perl scripts | |
65 | `(("perl" ,perl))) | |
66 | (arguments | |
67 | `(#:phases | |
dc1d3cde KK |
68 | (modify-phases %standard-phases |
69 | (replace 'install | |
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))) | |
75 | (begin | |
dc1d3cde KK |
76 | (for-each (lambda (h) |
77 | (install-file h doc)) | |
78 | `("License.txt" ,@(find-files "www" ".*\\.html"))) | |
79 | (for-each (lambda (b) | |
80 | (install-file b bin)) | |
81 | `("delta" "multidelta" "topformflat")))) | |
82 | #t)) | |
139ecdee | 83 | (delete 'configure)))) ; no configure script |
8d809faf EB |
84 | (home-page "http://delta.tigris.org/") |
85 | (synopsis "Heuristical file minimizer") | |
86 | (description | |
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. | |
93 | (license bsd-3))) | |
426fde9a EB |
94 | |
95 | (define-public c-reduce | |
96 | (package | |
97 | (name "c-reduce") | |
1d552f63 | 98 | (version "2.10.0") |
426fde9a EB |
99 | (source |
100 | (origin | |
101 | (method url-fetch) | |
102 | (uri (list | |
c23c628e | 103 | (string-append "http://embed.cs.utah.edu/creduce/" |
426fde9a EB |
104 | "creduce-" version ".tar.gz"))) |
105 | (sha256 | |
1d552f63 | 106 | (base32 "0qx0zq8jxzx2as2zf0740g7kvgq163ayn3041di4vwk77490y76v")))) |
426fde9a EB |
107 | (build-system gnu-build-system) |
108 | (inputs | |
109 | `(("astyle" ,astyle) | |
1d552f63 TGR |
110 | ("llvm" ,llvm) |
111 | ("clang" ,clang) | |
426fde9a EB |
112 | ("flex" ,flex) |
113 | ("indent" ,indent) | |
114 | ("perl" ,perl) | |
426fde9a EB |
115 | ("exporter-lite" ,perl-exporter-lite) |
116 | ("file-which" ,perl-file-which) | |
117 | ("getopt-tabular" ,perl-getopt-tabular) | |
118 | ("regex-common" ,perl-regexp-common) | |
28f45dd7 | 119 | ("term-readkey" ,perl-term-readkey))) |
426fde9a | 120 | (arguments |
dc1d3cde KK |
121 | `(#:phases |
122 | (modify-phases %standard-phases | |
a6de569e EB |
123 | (replace 'check |
124 | (lambda _ | |
125 | (with-directory-excursion "tests" | |
126 | ;; Running all tests can take a looong time, and tests 4 and 5 | |
127 | ;; require frama-c or kcc. So run just one for sanity. | |
128 | (invoke "./run_tests" "1")))) | |
dc1d3cde KK |
129 | (add-after 'install 'set-load-paths |
130 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
131 | ;; Tell creduce where to find the perl modules it needs. | |
132 | (let* ((out (assoc-ref outputs "out")) | |
133 | (prog (string-append out "/bin/creduce"))) | |
134 | (wrap-program | |
135 | prog | |
136 | `("PERL5LIB" ":" prefix | |
137 | ,(map (lambda (p) | |
138 | (string-append (assoc-ref inputs p) | |
139 | "/lib/perl5/site_perl/" | |
140 | ,(package-version perl))) | |
141 | '("term-readkey" "exporter-lite" | |
142 | "file-which" "getopt-tabular" | |
a6de569e | 143 | "regex-common"))))) |
dc1d3cde | 144 | #t))))) |
7649e426 | 145 | (home-page "https://embed.cs.utah.edu/creduce") |
426fde9a EB |
146 | (synopsis "Reducer for interesting code") |
147 | (description | |
148 | "C-Reduce is a tool that takes a large C or C++ program that has a | |
149 | property of interest (such as triggering a compiler bug) and automatically | |
150 | produces a much smaller C/C++ program that has the same property. It is | |
151 | intended for use by people who discover and report bugs in compilers and other | |
152 | tools that process C/C++ code.") | |
153 | (license ncsa))) | |
9b459fc7 EB |
154 | |
155 | (define-public american-fuzzy-lop | |
156 | (let ((machine (match (or (%current-target-system) | |
157 | (%current-system)) | |
158 | ("x86_64-linux" "x86_64") | |
159 | ("i686-linux" "i386") | |
aacefef2 EF |
160 | ("aarch64-linux" "aarch64") |
161 | ("armhf-linux" "arm") | |
162 | ("mips64el-linux" "mips64el") | |
9b459fc7 EB |
163 | ;; Prevent errors when querying this package on unsupported |
164 | ;; platforms, e.g. when running "guix package --search=" | |
165 | (_ "UNSUPPORTED")))) | |
166 | (package | |
167 | (name "american-fuzzy-lop") | |
7746af66 | 168 | (version "2.52b") ;It seems all releases have the 'b' suffix |
9b459fc7 EB |
169 | (source |
170 | (origin | |
171 | (method url-fetch) | |
172 | (uri (string-append "http://lcamtuf.coredump.cx/afl/releases/" | |
173 | "afl-" version ".tgz")) | |
174 | (sha256 | |
175 | (base32 | |
7746af66 | 176 | "0ig0ij4n1pwry5dw1hk4q88801jzzy2cric6y2gd6560j55lnqa3")))) |
9b459fc7 EB |
177 | (build-system gnu-build-system) |
178 | (inputs | |
179 | `(("custom-qemu" | |
7746af66 | 180 | ;; The afl-qemu tool builds qemu 2.10.0 with a few patches applied. |
27b52c1f | 181 | ,(package (inherit qemu-minimal-2.10) |
9b459fc7 EB |
182 | (name "afl-qemu") |
183 | (inputs | |
184 | `(("afl-src" ,source) | |
7746af66 | 185 | ,@(package-inputs qemu-minimal))) |
9b459fc7 EB |
186 | ;; afl only supports using a single afl-qemu-trace executable, so |
187 | ;; we only build qemu for the native target. | |
188 | (arguments | |
2d8211ab | 189 | `(#:modules ((srfi srfi-1) |
9b459fc7 | 190 | ,@%gnu-build-system-modules) |
7746af66 | 191 | ,@(substitute-keyword-arguments (package-arguments qemu-minimal) |
2d8211ab EB |
192 | ((#:configure-flags config-flags) |
193 | ``(,(string-append "--target-list=" ,machine "-linux-user") | |
194 | ,@(remove (λ (f) (string-prefix? "--target-list=" f)) | |
195 | ,config-flags))) | |
9b459fc7 EB |
196 | ((#:phases qemu-phases) |
197 | `(modify-phases ,qemu-phases | |
198 | (add-after | |
199 | 'unpack 'apply-afl-patches | |
200 | (lambda* (#:key inputs #:allow-other-keys) | |
201 | (let* ((afl-dir (string-append "afl-" ,version)) | |
202 | (patch-dir | |
203 | (string-append afl-dir | |
204 | "/qemu_mode/patches"))) | |
75ac5e20 RW |
205 | (invoke "tar" "xf" |
206 | (assoc-ref inputs "afl-src")) | |
f3860753 TGR |
207 | (install-file (string-append patch-dir |
208 | "/afl-qemu-cpu-inl.h") | |
209 | ".") | |
9b459fc7 EB |
210 | (copy-file (string-append afl-dir "/config.h") |
211 | "./afl-config.h") | |
f3860753 TGR |
212 | (install-file (string-append afl-dir "/types.h") |
213 | ".") | |
9b459fc7 EB |
214 | (substitute* "afl-qemu-cpu-inl.h" |
215 | (("\\.\\./\\.\\./config.h") "afl-config.h")) | |
216 | (substitute* (string-append patch-dir | |
217 | "/cpu-exec.diff") | |
218 | (("\\.\\./patches/") "")) | |
75ac5e20 RW |
219 | (for-each (lambda (patch-file) |
220 | (invoke "patch" "--force" "-p1" | |
221 | "--input" patch-file)) | |
222 | (find-files patch-dir | |
223 | "\\.diff$")) | |
224 | #t)))))))))))) | |
9b459fc7 EB |
225 | (arguments |
226 | `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
227 | "CC=gcc") | |
228 | #:phases (modify-phases %standard-phases | |
229 | (delete 'configure) | |
aacefef2 EF |
230 | ,@(if (string=? (%current-system) (or "x86_64-linux" |
231 | "i686-linux")) | |
232 | '() | |
233 | '((add-before 'build 'set-afl-flag | |
234 | (lambda _ (setenv "AFL_NO_X86" "1") #t)) | |
235 | (add-after 'install 'remove-x86-programs | |
236 | (lambda* (#:key outputs #:allow-other-keys) | |
237 | (let* ((out (assoc-ref outputs "out")) | |
238 | (bin (string-append out "/bin/"))) | |
239 | (delete-file (string-append bin "afl-gcc")) | |
240 | (delete-file (string-append bin "afl-g++")) | |
241 | (delete-file (string-append bin "afl-clang")) | |
242 | (delete-file (string-append bin "afl-clang++"))) | |
243 | #t)))) | |
9b459fc7 EB |
244 | (add-after |
245 | ;; TODO: Build and install the afl-llvm tool. | |
246 | 'install 'install-qemu | |
247 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
248 | (let ((qemu (assoc-ref inputs "custom-qemu")) | |
249 | (out (assoc-ref outputs "out"))) | |
b6d937d9 EB |
250 | (symlink (string-append qemu "/bin/qemu-" ,machine) |
251 | (string-append out "/bin/afl-qemu-trace")) | |
9b459fc7 | 252 | #t))) |
aacefef2 | 253 | (delete 'check)))) ; Tests are run during 'install phase. |
9b459fc7 EB |
254 | (home-page "http://lcamtuf.coredump.cx/afl") |
255 | (synopsis "Security-oriented fuzzer") | |
256 | (description | |
257 | "American fuzzy lop is a security-oriented fuzzer that employs a novel | |
258 | type of compile-time instrumentation and genetic algorithms to automatically | |
259 | discover clean, interesting test cases that trigger new internal states in the | |
260 | targeted binary. This substantially improves the functional coverage for the | |
261 | fuzzed code. The compact synthesized corpora produced by the tool are also | |
262 | useful for seeding other, more labor- or resource-intensive testing regimes | |
263 | down the road.") | |
264 | (license asl2.0)))) | |
b718bef0 EB |
265 | |
266 | (define-public stress-make | |
136e3b39 EB |
267 | (let ((commit "9e92dff8f0157f012aaf31de5b8b8112ad720100") |
268 | (revision "1")) ;No official source distribution | |
b718bef0 EB |
269 | (package |
270 | (name "stress-make") | |
136e3b39 | 271 | (version (git-version "1.0" revision commit)) |
b718bef0 EB |
272 | (source |
273 | (origin | |
274 | (method git-fetch) | |
275 | (uri (git-reference | |
136e3b39 | 276 | (url "https://github.com/lanl/stress-make.git") |
b718bef0 | 277 | (commit commit))) |
136e3b39 | 278 | (file-name (git-file-name name version)) |
b718bef0 EB |
279 | (sha256 |
280 | (base32 | |
136e3b39 | 281 | "1z1yiwnqyzv3v6152fnjbfh2lr8q8fi5xxfdclnr8l8sd4c1rasp")))) |
b718bef0 EB |
282 | (build-system gnu-build-system) |
283 | (native-inputs | |
284 | `(("autoconf" ,autoconf) | |
285 | ("automake" ,automake) | |
286 | ("go" ,go))) | |
287 | (inputs | |
288 | `(("make-source" ,(package-source gnu-make)))) | |
289 | (arguments | |
290 | ;; stress-make's configure script insists on having a tarball and does | |
291 | ;; not accept a directory name instead. To let the gnu-build-system's | |
292 | ;; patch-* phases work properly, we unpack the source first, then | |
293 | ;; repack before the configure phase. | |
05cca6ce | 294 | (let ((make-dir (string-append "make-" (package-version gnu-make)))) |
fd466fb8 EB |
295 | `(#:configure-flags '("--with-make-tar=./make.tar.xz" |
296 | "make_cv_sys_gnu_glob=yes") | |
05cca6ce EB |
297 | #:phases |
298 | (modify-phases %standard-phases | |
299 | (add-after 'unpack 'unpack-make | |
300 | (lambda* (#:key inputs #:allow-other-keys) | |
4aa266a0 | 301 | (invoke "tar" "xf" (assoc-ref inputs "make-source")))) |
05cca6ce EB |
302 | (add-after 'unpack-make 'set-default-shell |
303 | (lambda _ | |
304 | ;; Taken mostly directly from (@ (gnu packages base) gnu-make) | |
305 | (substitute* (string-append ,make-dir "/job.c") | |
306 | (("default_shell = .*$") | |
307 | (format #f "default_shell = \"~a\";\n" | |
308 | (which "sh")))))) | |
309 | (add-before 'configure 'repack-make | |
310 | (lambda _ | |
136e3b39 EB |
311 | (invoke "tar" "cJf" "./make.tar.xz" ,make-dir))) |
312 | (add-before 'build 'setup-go | |
313 | ;; The Go cache is required starting in Go 1.12, and it needs | |
314 | ;; to be writable. | |
315 | (lambda _ (setenv "GOCACHE" "/tmp/go-cache") #t)))))) | |
316 | (home-page "https://github.com/lanl/stress-make") | |
b718bef0 EB |
317 | (synopsis "Expose race conditions in Makefiles") |
318 | (description | |
f457397a | 319 | "Stress Make is a customized GNU Make that explicitly manages the order |
a988cbb7 TGR |
320 | in which concurrent jobs are run to provoke erroneous behavior into becoming |
321 | manifest. It can run jobs in the order in which they're launched, in backwards | |
322 | order, or in random order. The thought is that if code builds correctly with | |
323 | Stress Make, then it is likely that the @code{Makefile} contains no race | |
324 | conditions.") | |
b718bef0 EB |
325 | ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated, |
326 | ;; and patched GNU Make is under its own license. | |
136e3b39 | 327 | (license (list (non-copyleft "LICENSE.md") |
a72aab9f | 328 | gpl3+))))) |
660516e8 JD |
329 | |
330 | (define-public zzuf | |
331 | (package | |
332 | (name "zzuf") | |
333 | (version "0.15") | |
334 | (source | |
335 | (origin | |
336 | (method url-fetch) | |
337 | (uri (string-append | |
338 | "https://github.com/samhocevar/zzuf/releases/download/v" | |
339 | version "/" name "-" version ".tar.gz")) | |
340 | (file-name (string-append name "-" version ".tar.gz")) | |
341 | (sha256 | |
342 | (base32 | |
343 | "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3")))) | |
344 | (build-system gnu-build-system) | |
345 | (home-page "https://github.com/samhocevar/zzuf") | |
346 | (synopsis "Transparent application input fuzzer") | |
347 | (description "Zzuf is a transparent application input fuzzer. It works by | |
348 | intercepting file operations and changing random bits in the program's | |
349 | input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.") | |
350 | (license (non-copyleft "http://www.wtfpl.net/txt/copying/")))) | |
a778f270 P |
351 | |
352 | (define-public scanmem | |
353 | (package | |
354 | (name "scanmem") | |
355 | (version "0.17") | |
356 | (source | |
357 | (origin | |
358 | (method git-fetch) | |
359 | (uri (git-reference | |
360 | (url "https://github.com/scanmem/scanmem") | |
361 | (commit (string-append "v" version)))) | |
362 | (file-name (git-file-name name version)) | |
363 | (sha256 | |
364 | (base32 | |
365 | "17p8sh0rj8yqz36ria5bp48c8523zzw3y9g8sbm2jwq7sc27i7s9")))) | |
366 | (build-system gnu-build-system) | |
f20c64ed RH |
367 | (arguments |
368 | `(#:configure-flags '("--enable-gui") | |
369 | #:phases | |
370 | (modify-phases %standard-phases | |
371 | (add-before 'configure 'hardcode-python | |
372 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
373 | (substitute* "gui/GameConqueror.py" | |
374 | (("/usr/bin/env python") | |
375 | (string-append (assoc-ref %build-inputs | |
376 | "python-wrapper") "/bin/python"))) | |
377 | #t)) | |
378 | (add-after 'install 'wrap-gameconqueror | |
379 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
380 | (let ((out (assoc-ref outputs "out")) | |
381 | (gi-typelib-path (getenv "GI_TYPELIB_PATH")) | |
382 | (python-path (getenv "PYTHONPATH"))) | |
383 | (wrap-program (string-append out "/share/gameconqueror/GameConqueror.py") | |
384 | `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)) | |
385 | `("PYTHONPATH" ":" prefix (,python-path)))) | |
386 | #t))))) | |
a778f270 P |
387 | (native-inputs |
388 | `(("libtool" ,libtool) | |
f20c64ed RH |
389 | ("python-wrapper" ,python-wrapper) |
390 | ("gobject-introspection" ,gobject-introspection) | |
391 | ("gtk+" ,gtk+) | |
a778f270 P |
392 | ("intltool" ,intltool) |
393 | ("automake" ,automake) | |
394 | ("autoconf" ,autoconf))) | |
395 | (inputs | |
396 | `(("readline" ,readline))) | |
f20c64ed RH |
397 | (propagated-inputs |
398 | `(("python-pygobject" ,python-pygobject))) | |
a778f270 P |
399 | (home-page "https://github.com/scanmem/scanmem") |
400 | (synopsis "Memory scanner") | |
401 | (description "Scanmem is a debugging utility designed to isolate the | |
402 | address of an arbitrary variable in an executing process. Scanmem simply | |
403 | needs to be told the pid of the process and the value of the variable at | |
404 | several different times. After several scans of the process, scanmem isolates | |
405 | the position of the variable and allows you to modify its value.") | |
406 | ;; The library is covered by LGPLv3 or later; the application is covered | |
407 | ;; by GPLv3 or later. | |
408 | (license (list lgpl3+ gpl3+)))) |