Commit | Line | Data |
---|---|---|
8d809faf | 1 | ;;; GNU Guix --- Functional package management for GNU |
05cca6ce | 2 | ;;; Copyright © 2014, 2015, 2016, 2017 Eric Bavier <bavier@member.fsf.org> |
aacefef2 | 3 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
8d809faf EB |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu packages debug) | |
21 | #:use-module (guix packages) | |
22 | #:use-module (guix licenses) | |
23 | #:use-module (guix download) | |
b718bef0 | 24 | #:use-module (guix git-download) |
426fde9a | 25 | #:use-module (guix utils) |
8d809faf | 26 | #:use-module (guix build-system gnu) |
b718bef0 EB |
27 | #:use-module (gnu packages autotools) |
28 | #:use-module (gnu packages base) | |
426fde9a EB |
29 | #:use-module (gnu packages bash) |
30 | #:use-module (gnu packages flex) | |
b718bef0 | 31 | #:use-module (gnu packages golang) |
426fde9a EB |
32 | #:use-module (gnu packages indent) |
33 | #:use-module (gnu packages llvm) | |
34 | #:use-module (gnu packages perl) | |
9b459fc7 | 35 | #:use-module (gnu packages pretty-print) |
59132b80 | 36 | #:use-module (gnu packages virtualization) |
9b459fc7 EB |
37 | #:use-module (ice-9 match) |
38 | #:use-module (srfi srfi-1)) | |
8d809faf EB |
39 | |
40 | (define-public delta | |
41 | (package | |
42 | (name "delta") | |
43 | (version "2006.08.03") | |
44 | (source | |
45 | (origin | |
46 | (method url-fetch) | |
47 | (uri (list | |
48 | (string-append "http://ftp.de.debian.org/debian/pool/main/d/delta/" | |
49 | "delta_" version ".orig.tar.gz") | |
50 | ;; This uri seems to send guix download into an infinite loop | |
51 | (string-append "http://delta.tigris.org/files/documents/3103/" | |
52 | "33566/delta-" version ".tar.gz"))) | |
53 | (sha256 | |
54 | (base32 | |
55 | "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q")))) | |
56 | (build-system gnu-build-system) | |
57 | (inputs ;Installed programs are perl scripts | |
58 | `(("perl" ,perl))) | |
59 | (arguments | |
60 | `(#:phases | |
dc1d3cde KK |
61 | (modify-phases %standard-phases |
62 | (replace 'install | |
63 | (lambda* (#:key outputs #:allow-other-keys) | |
64 | ;; Makefile contains no install target | |
65 | (let* ((out (assoc-ref outputs "out")) | |
66 | (bin (string-append out "/bin")) | |
67 | (doc (string-append out "/share/doc/delta-" ,version))) | |
68 | (begin | |
69 | (mkdir-p bin) | |
70 | (mkdir-p doc) | |
71 | (for-each (lambda (h) | |
72 | (install-file h doc)) | |
73 | `("License.txt" ,@(find-files "www" ".*\\.html"))) | |
74 | (for-each (lambda (b) | |
75 | (install-file b bin)) | |
76 | `("delta" "multidelta" "topformflat")))) | |
77 | #t)) | |
78 | (delete 'configure)))) | |
8d809faf EB |
79 | (home-page "http://delta.tigris.org/") |
80 | (synopsis "Heuristical file minimizer") | |
81 | (description | |
82 | "Delta assists you in minimizing \"interesting\" files subject to a test | |
83 | of their interestingness. A common such situation is when attempting to | |
84 | isolate a small failure-inducing substring of a large input that causes your | |
85 | program to exhibit a bug.") | |
86 | ;; See License.txt, which is a bsd-3 license, despite the project's | |
87 | ;; home-page pointing to a bsd-2 license. | |
88 | (license bsd-3))) | |
426fde9a EB |
89 | |
90 | (define-public c-reduce | |
91 | (package | |
92 | (name "c-reduce") | |
28f45dd7 | 93 | (version "2.5.0") |
426fde9a EB |
94 | (source |
95 | (origin | |
96 | (method url-fetch) | |
97 | (uri (list | |
c23c628e | 98 | (string-append "http://embed.cs.utah.edu/creduce/" |
426fde9a EB |
99 | "creduce-" version ".tar.gz"))) |
100 | (sha256 | |
101 | (base32 | |
28f45dd7 | 102 | "1r23lhzq3dz8vi2dalxk5las8bf0av2w94hxxbs61pr73m77ik9d")))) |
426fde9a EB |
103 | (build-system gnu-build-system) |
104 | (inputs | |
105 | `(("astyle" ,astyle) | |
61be05c3 EB |
106 | ("llvm" ,llvm) |
107 | ("clang" ,clang) | |
426fde9a EB |
108 | ("flex" ,flex) |
109 | ("indent" ,indent) | |
110 | ("perl" ,perl) | |
426fde9a EB |
111 | ("exporter-lite" ,perl-exporter-lite) |
112 | ("file-which" ,perl-file-which) | |
113 | ("getopt-tabular" ,perl-getopt-tabular) | |
114 | ("regex-common" ,perl-regexp-common) | |
28f45dd7 EB |
115 | ("sys-cpu" ,perl-sys-cpu) |
116 | ("term-readkey" ,perl-term-readkey))) | |
426fde9a | 117 | (arguments |
dc1d3cde KK |
118 | `(#:phases |
119 | (modify-phases %standard-phases | |
120 | (add-after 'install 'set-load-paths | |
121 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
122 | ;; Tell creduce where to find the perl modules it needs. | |
123 | (let* ((out (assoc-ref outputs "out")) | |
124 | (prog (string-append out "/bin/creduce"))) | |
125 | (wrap-program | |
126 | prog | |
127 | `("PERL5LIB" ":" prefix | |
128 | ,(map (lambda (p) | |
129 | (string-append (assoc-ref inputs p) | |
130 | "/lib/perl5/site_perl/" | |
131 | ,(package-version perl))) | |
132 | '("term-readkey" "exporter-lite" | |
133 | "file-which" "getopt-tabular" | |
134 | "regex-common" "sys-cpu"))))) | |
135 | #t))))) | |
c23c628e | 136 | (home-page "http://embed.cs.utah.edu/creduce") |
426fde9a EB |
137 | (synopsis "Reducer for interesting code") |
138 | (description | |
139 | "C-Reduce is a tool that takes a large C or C++ program that has a | |
140 | property of interest (such as triggering a compiler bug) and automatically | |
141 | produces a much smaller C/C++ program that has the same property. It is | |
142 | intended for use by people who discover and report bugs in compilers and other | |
143 | tools that process C/C++ code.") | |
144 | (license ncsa))) | |
9b459fc7 | 145 | |
4f14c628 LC |
146 | (define qemu-2.3.0 |
147 | (package | |
06da1a6b | 148 | (inherit qemu-minimal) |
4f14c628 LC |
149 | (version "2.3.0") |
150 | (source (origin | |
151 | (method url-fetch) | |
152 | (uri (string-append | |
153 | "http://wiki.qemu-project.org/download/qemu-" | |
154 | version ".tar.bz2")) | |
155 | (sha256 | |
156 | (base32 | |
157 | "120m53c3p28qxmfzllicjzr8syjv6v4d9rsyrgkp7gnmcgvvgfmn")))) | |
158 | (arguments | |
159 | ;; XXX: Disable tests because of GTester's rejection of duplicate test | |
160 | ;; names, which wasn't addressed in this version of QEMU. | |
161 | `(#:tests? #f | |
83723949 EF |
162 | ,@(substitute-keyword-arguments (package-arguments qemu-minimal) |
163 | ((#:phases phases) | |
164 | ;; We disable the tests so we skip the phase disabling the qga test. | |
165 | `(modify-phases ,phases (delete 'disable-test-qga)))))))) | |
4f14c628 | 166 | |
9b459fc7 EB |
167 | (define-public american-fuzzy-lop |
168 | (let ((machine (match (or (%current-target-system) | |
169 | (%current-system)) | |
170 | ("x86_64-linux" "x86_64") | |
171 | ("i686-linux" "i386") | |
aacefef2 EF |
172 | ("aarch64-linux" "aarch64") |
173 | ("armhf-linux" "arm") | |
174 | ("mips64el-linux" "mips64el") | |
9b459fc7 EB |
175 | ;; Prevent errors when querying this package on unsupported |
176 | ;; platforms, e.g. when running "guix package --search=" | |
177 | (_ "UNSUPPORTED")))) | |
178 | (package | |
179 | (name "american-fuzzy-lop") | |
a71fd671 | 180 | (version "2.49b") ;It seems all releases have the 'b' suffix |
9b459fc7 EB |
181 | (source |
182 | (origin | |
183 | (method url-fetch) | |
184 | (uri (string-append "http://lcamtuf.coredump.cx/afl/releases/" | |
185 | "afl-" version ".tgz")) | |
186 | (sha256 | |
187 | (base32 | |
a71fd671 | 188 | "1lc8mpwlbyb1iil9961yfysp8l2l4nw0s07781m1haiz4jq2rigp")))) |
9b459fc7 EB |
189 | (build-system gnu-build-system) |
190 | (inputs | |
191 | `(("custom-qemu" | |
192 | ;; The afl-qemu tool builds qemu 2.3.0 with a few patches applied. | |
4f14c628 | 193 | ,(package (inherit qemu-2.3.0) |
9b459fc7 EB |
194 | (name "afl-qemu") |
195 | (inputs | |
196 | `(("afl-src" ,source) | |
4f14c628 | 197 | ,@(package-inputs qemu-2.3.0))) |
9b459fc7 EB |
198 | ;; afl only supports using a single afl-qemu-trace executable, so |
199 | ;; we only build qemu for the native target. | |
200 | (arguments | |
2d8211ab | 201 | `(#:modules ((srfi srfi-1) |
9b459fc7 | 202 | ,@%gnu-build-system-modules) |
4f14c628 | 203 | ,@(substitute-keyword-arguments (package-arguments qemu-2.3.0) |
2d8211ab EB |
204 | ((#:configure-flags config-flags) |
205 | ``(,(string-append "--target-list=" ,machine "-linux-user") | |
206 | ,@(remove (λ (f) (string-prefix? "--target-list=" f)) | |
207 | ,config-flags))) | |
9b459fc7 EB |
208 | ((#:phases qemu-phases) |
209 | `(modify-phases ,qemu-phases | |
210 | (add-after | |
211 | 'unpack 'apply-afl-patches | |
212 | (lambda* (#:key inputs #:allow-other-keys) | |
213 | (let* ((afl-dir (string-append "afl-" ,version)) | |
214 | (patch-dir | |
215 | (string-append afl-dir | |
216 | "/qemu_mode/patches"))) | |
217 | (unless (zero? | |
218 | (system* "tar" "xf" | |
219 | (assoc-ref inputs "afl-src"))) | |
220 | (error "tar failed to unpack afl-src")) | |
f3860753 TGR |
221 | (install-file (string-append patch-dir |
222 | "/afl-qemu-cpu-inl.h") | |
223 | ".") | |
9b459fc7 EB |
224 | (copy-file (string-append afl-dir "/config.h") |
225 | "./afl-config.h") | |
f3860753 TGR |
226 | (install-file (string-append afl-dir "/types.h") |
227 | ".") | |
9b459fc7 EB |
228 | (substitute* "afl-qemu-cpu-inl.h" |
229 | (("\\.\\./\\.\\./config.h") "afl-config.h")) | |
230 | (substitute* (string-append patch-dir | |
231 | "/cpu-exec.diff") | |
232 | (("\\.\\./patches/") "")) | |
233 | (every (lambda (patch-file) | |
234 | (zero? (system* "patch" "--force" "-p1" | |
235 | "--input" patch-file))) | |
236 | (find-files patch-dir | |
237 | "\\.diff$")))))))))))))) | |
238 | (arguments | |
239 | `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
240 | "CC=gcc") | |
241 | #:phases (modify-phases %standard-phases | |
242 | (delete 'configure) | |
aacefef2 EF |
243 | ,@(if (string=? (%current-system) (or "x86_64-linux" |
244 | "i686-linux")) | |
245 | '() | |
246 | '((add-before 'build 'set-afl-flag | |
247 | (lambda _ (setenv "AFL_NO_X86" "1") #t)) | |
248 | (add-after 'install 'remove-x86-programs | |
249 | (lambda* (#:key outputs #:allow-other-keys) | |
250 | (let* ((out (assoc-ref outputs "out")) | |
251 | (bin (string-append out "/bin/"))) | |
252 | (delete-file (string-append bin "afl-gcc")) | |
253 | (delete-file (string-append bin "afl-g++")) | |
254 | (delete-file (string-append bin "afl-clang")) | |
255 | (delete-file (string-append bin "afl-clang++"))) | |
256 | #t)))) | |
9b459fc7 EB |
257 | (add-after |
258 | ;; TODO: Build and install the afl-llvm tool. | |
259 | 'install 'install-qemu | |
260 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
261 | (let ((qemu (assoc-ref inputs "custom-qemu")) | |
262 | (out (assoc-ref outputs "out"))) | |
b6d937d9 EB |
263 | (symlink (string-append qemu "/bin/qemu-" ,machine) |
264 | (string-append out "/bin/afl-qemu-trace")) | |
9b459fc7 | 265 | #t))) |
aacefef2 | 266 | (delete 'check)))) ; Tests are run during 'install phase. |
9b459fc7 EB |
267 | (home-page "http://lcamtuf.coredump.cx/afl") |
268 | (synopsis "Security-oriented fuzzer") | |
269 | (description | |
270 | "American fuzzy lop is a security-oriented fuzzer that employs a novel | |
271 | type of compile-time instrumentation and genetic algorithms to automatically | |
272 | discover clean, interesting test cases that trigger new internal states in the | |
273 | targeted binary. This substantially improves the functional coverage for the | |
274 | fuzzed code. The compact synthesized corpora produced by the tool are also | |
275 | useful for seeding other, more labor- or resource-intensive testing regimes | |
276 | down the road.") | |
277 | (license asl2.0)))) | |
b718bef0 EB |
278 | |
279 | (define-public stress-make | |
280 | (let ((commit "506e6cfd98d165f22bee91c408b7c20117a682c4") | |
281 | (revision "0")) ;No official source distribution | |
282 | (package | |
283 | (name "stress-make") | |
284 | (version (string-append "1.0-" revision "." (string-take commit 7))) | |
285 | (source | |
286 | (origin | |
287 | (method git-fetch) | |
288 | (uri (git-reference | |
289 | (url "https://github.com/losalamos/stress-make.git") | |
290 | (commit commit))) | |
291 | (file-name (string-append name "-" version "-checkout")) | |
292 | (sha256 | |
293 | (base32 | |
294 | "1j330yqhc7plwin04qxbh8afpg5nfnw1xvnmh8rk6mmqg9w6ik70")))) | |
295 | (build-system gnu-build-system) | |
296 | (native-inputs | |
297 | `(("autoconf" ,autoconf) | |
298 | ("automake" ,automake) | |
299 | ("go" ,go))) | |
300 | (inputs | |
301 | `(("make-source" ,(package-source gnu-make)))) | |
302 | (arguments | |
303 | ;; stress-make's configure script insists on having a tarball and does | |
304 | ;; not accept a directory name instead. To let the gnu-build-system's | |
305 | ;; patch-* phases work properly, we unpack the source first, then | |
306 | ;; repack before the configure phase. | |
05cca6ce EB |
307 | (let ((make-dir (string-append "make-" (package-version gnu-make)))) |
308 | `(#:configure-flags '("--with-make-tar=./make.tar.xz") | |
309 | #:phases | |
310 | (modify-phases %standard-phases | |
311 | (add-after 'unpack 'unpack-make | |
312 | (lambda* (#:key inputs #:allow-other-keys) | |
313 | (zero? (system* "tar" "xf" (assoc-ref inputs "make-source"))))) | |
314 | (add-after 'unpack-make 'set-default-shell | |
315 | (lambda _ | |
316 | ;; Taken mostly directly from (@ (gnu packages base) gnu-make) | |
317 | (substitute* (string-append ,make-dir "/job.c") | |
318 | (("default_shell = .*$") | |
319 | (format #f "default_shell = \"~a\";\n" | |
320 | (which "sh")))))) | |
321 | (add-before 'configure 'repack-make | |
322 | (lambda _ | |
323 | (zero? (system* "tar" "cJf" "./make.tar.xz" ,make-dir)))) | |
d10092b8 | 324 | (add-after 'unpack 'bootstrap |
05cca6ce EB |
325 | (lambda _ |
326 | (zero? (system* "autoreconf" "-vfi")))))))) | |
b718bef0 EB |
327 | (home-page "https://github.com/losalamos/stress-make") |
328 | (synopsis "Expose race conditions in Makefiles") | |
329 | (description | |
a988cbb7 TGR |
330 | "Stress Make is a customized GNU Make that explicitely manages the order |
331 | in which concurrent jobs are run to provoke erroneous behavior into becoming | |
332 | manifest. It can run jobs in the order in which they're launched, in backwards | |
333 | order, or in random order. The thought is that if code builds correctly with | |
334 | Stress Make, then it is likely that the @code{Makefile} contains no race | |
335 | conditions.") | |
b718bef0 EB |
336 | ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated, |
337 | ;; and patched GNU Make is under its own license. | |
338 | (license (list (non-copyleft "COPYING.md") | |
339 | (package-license gnu-make)))))) | |
660516e8 JD |
340 | |
341 | (define-public zzuf | |
342 | (package | |
343 | (name "zzuf") | |
344 | (version "0.15") | |
345 | (source | |
346 | (origin | |
347 | (method url-fetch) | |
348 | (uri (string-append | |
349 | "https://github.com/samhocevar/zzuf/releases/download/v" | |
350 | version "/" name "-" version ".tar.gz")) | |
351 | (file-name (string-append name "-" version ".tar.gz")) | |
352 | (sha256 | |
353 | (base32 | |
354 | "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3")))) | |
355 | (build-system gnu-build-system) | |
356 | (home-page "https://github.com/samhocevar/zzuf") | |
357 | (synopsis "Transparent application input fuzzer") | |
358 | (description "Zzuf is a transparent application input fuzzer. It works by | |
359 | intercepting file operations and changing random bits in the program's | |
360 | input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.") | |
361 | (license (non-copyleft "http://www.wtfpl.net/txt/copying/")))) |