Commit | Line | Data |
---|---|---|
8d809faf | 1 | ;;; GNU Guix --- Functional package management for GNU |
2d8211ab | 2 | ;;; Copyright © 2014, 2015, 2016 Eric Bavier <bavier@member.fsf.org> |
8d809faf EB |
3 | ;;; |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
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. | |
10 | ;;; | |
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. | |
15 | ;;; | |
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/>. | |
18 | ||
19 | (define-module (gnu packages debug) | |
20 | #:use-module (guix packages) | |
21 | #:use-module (guix licenses) | |
22 | #:use-module (guix download) | |
b718bef0 | 23 | #:use-module (guix git-download) |
426fde9a | 24 | #:use-module (guix utils) |
8d809faf | 25 | #:use-module (guix build-system gnu) |
b718bef0 EB |
26 | #:use-module (gnu packages autotools) |
27 | #:use-module (gnu packages base) | |
426fde9a EB |
28 | #:use-module (gnu packages bash) |
29 | #:use-module (gnu packages flex) | |
b718bef0 | 30 | #:use-module (gnu packages golang) |
426fde9a EB |
31 | #:use-module (gnu packages indent) |
32 | #:use-module (gnu packages llvm) | |
33 | #:use-module (gnu packages perl) | |
9b459fc7 EB |
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)) | |
8d809faf EB |
38 | |
39 | (define-public delta | |
40 | (package | |
41 | (name "delta") | |
42 | (version "2006.08.03") | |
43 | (source | |
44 | (origin | |
45 | (method url-fetch) | |
46 | (uri (list | |
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"))) | |
52 | (sha256 | |
53 | (base32 | |
54 | "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q")))) | |
55 | (build-system gnu-build-system) | |
56 | (inputs ;Installed programs are perl scripts | |
57 | `(("perl" ,perl))) | |
58 | (arguments | |
59 | `(#:phases | |
60 | (alist-replace | |
61 | 'install | |
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))) | |
67 | (begin | |
68 | (mkdir-p bin) | |
69 | (mkdir-p doc) | |
70 | (for-each (lambda (h) | |
71 | (copy-file h (string-append doc "/" (basename h)))) | |
72 | `("License.txt" ,@(find-files "www" ".*\\.html"))) | |
73 | (for-each (lambda (b) | |
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") | |
79 | (description | |
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. | |
86 | (license bsd-3))) | |
426fde9a EB |
87 | |
88 | (define-public c-reduce | |
89 | (package | |
90 | (name "c-reduce") | |
28f45dd7 | 91 | (version "2.5.0") |
426fde9a EB |
92 | (source |
93 | (origin | |
94 | (method url-fetch) | |
95 | (uri (list | |
c23c628e | 96 | (string-append "http://embed.cs.utah.edu/creduce/" |
426fde9a EB |
97 | "creduce-" version ".tar.gz"))) |
98 | (sha256 | |
99 | (base32 | |
28f45dd7 | 100 | "1r23lhzq3dz8vi2dalxk5las8bf0av2w94hxxbs61pr73m77ik9d")))) |
426fde9a EB |
101 | (build-system gnu-build-system) |
102 | (inputs | |
103 | `(("astyle" ,astyle) | |
61be05c3 EB |
104 | ("llvm" ,llvm) |
105 | ("clang" ,clang) | |
426fde9a EB |
106 | ("flex" ,flex) |
107 | ("indent" ,indent) | |
108 | ("perl" ,perl) | |
426fde9a EB |
109 | ("exporter-lite" ,perl-exporter-lite) |
110 | ("file-which" ,perl-file-which) | |
111 | ("getopt-tabular" ,perl-getopt-tabular) | |
112 | ("regex-common" ,perl-regexp-common) | |
28f45dd7 EB |
113 | ("sys-cpu" ,perl-sys-cpu) |
114 | ("term-readkey" ,perl-term-readkey))) | |
426fde9a EB |
115 | (arguments |
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"))) | |
122 | (wrap-program | |
123 | prog | |
124 | `("PERL5LIB" ":" prefix | |
125 | ,(map (lambda (p) | |
126 | (string-append (assoc-ref inputs p) | |
127 | "/lib/perl5/site_perl/" | |
128 | ,(package-version perl))) | |
28f45dd7 | 129 | '("term-readkey" "exporter-lite" |
426fde9a EB |
130 | "file-which" "getopt-tabular" |
131 | "regex-common" "sys-cpu")))))) | |
132 | %standard-phases))) | |
c23c628e | 133 | (home-page "http://embed.cs.utah.edu/creduce") |
426fde9a EB |
134 | (synopsis "Reducer for interesting code") |
135 | (description | |
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.") | |
141 | (license ncsa))) | |
9b459fc7 | 142 | |
4f14c628 LC |
143 | (define qemu-2.3.0 |
144 | (package | |
06da1a6b | 145 | (inherit qemu-minimal) |
4f14c628 LC |
146 | (version "2.3.0") |
147 | (source (origin | |
148 | (method url-fetch) | |
149 | (uri (string-append | |
150 | "http://wiki.qemu-project.org/download/qemu-" | |
151 | version ".tar.bz2")) | |
152 | (sha256 | |
153 | (base32 | |
154 | "120m53c3p28qxmfzllicjzr8syjv6v4d9rsyrgkp7gnmcgvvgfmn")))) | |
155 | (arguments | |
156 | ;; XXX: Disable tests because of GTester's rejection of duplicate test | |
157 | ;; names, which wasn't addressed in this version of QEMU. | |
158 | `(#:tests? #f | |
83723949 EF |
159 | ,@(substitute-keyword-arguments (package-arguments qemu-minimal) |
160 | ((#:phases phases) | |
161 | ;; We disable the tests so we skip the phase disabling the qga test. | |
162 | `(modify-phases ,phases (delete 'disable-test-qga)))))))) | |
4f14c628 | 163 | |
9b459fc7 EB |
164 | (define-public american-fuzzy-lop |
165 | (let ((machine (match (or (%current-target-system) | |
166 | (%current-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=" | |
171 | (_ "UNSUPPORTED")))) | |
172 | (package | |
173 | (name "american-fuzzy-lop") | |
2f046a0d | 174 | (version "2.15b") ;It seems all releases have the 'b' suffix |
9b459fc7 EB |
175 | (source |
176 | (origin | |
177 | (method url-fetch) | |
178 | (uri (string-append "http://lcamtuf.coredump.cx/afl/releases/" | |
179 | "afl-" version ".tgz")) | |
180 | (sha256 | |
181 | (base32 | |
2f046a0d | 182 | "04n2jfkchpz6a07w694b0im1vcmc3220ryqcaasa7vix7784wzs2")))) |
9b459fc7 EB |
183 | (build-system gnu-build-system) |
184 | (inputs | |
185 | `(("custom-qemu" | |
186 | ;; The afl-qemu tool builds qemu 2.3.0 with a few patches applied. | |
4f14c628 | 187 | ,(package (inherit qemu-2.3.0) |
9b459fc7 EB |
188 | (name "afl-qemu") |
189 | (inputs | |
190 | `(("afl-src" ,source) | |
4f14c628 | 191 | ,@(package-inputs qemu-2.3.0))) |
9b459fc7 EB |
192 | ;; afl only supports using a single afl-qemu-trace executable, so |
193 | ;; we only build qemu for the native target. | |
194 | (arguments | |
2d8211ab | 195 | `(#:modules ((srfi srfi-1) |
9b459fc7 | 196 | ,@%gnu-build-system-modules) |
4f14c628 | 197 | ,@(substitute-keyword-arguments (package-arguments qemu-2.3.0) |
2d8211ab EB |
198 | ((#:configure-flags config-flags) |
199 | ``(,(string-append "--target-list=" ,machine "-linux-user") | |
200 | ,@(remove (λ (f) (string-prefix? "--target-list=" f)) | |
201 | ,config-flags))) | |
9b459fc7 EB |
202 | ((#:phases qemu-phases) |
203 | `(modify-phases ,qemu-phases | |
204 | (add-after | |
205 | 'unpack 'apply-afl-patches | |
206 | (lambda* (#:key inputs #:allow-other-keys) | |
207 | (let* ((afl-dir (string-append "afl-" ,version)) | |
208 | (patch-dir | |
209 | (string-append afl-dir | |
210 | "/qemu_mode/patches"))) | |
211 | (unless (zero? | |
212 | (system* "tar" "xf" | |
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") | |
219 | "./afl-config.h") | |
220 | (copy-file (string-append afl-dir "/types.h") | |
221 | "./types.h") | |
222 | (substitute* "afl-qemu-cpu-inl.h" | |
223 | (("\\.\\./\\.\\./config.h") "afl-config.h")) | |
224 | (substitute* (string-append patch-dir | |
225 | "/cpu-exec.diff") | |
226 | (("\\.\\./patches/") "")) | |
227 | (every (lambda (patch-file) | |
228 | (zero? (system* "patch" "--force" "-p1" | |
229 | "--input" patch-file))) | |
230 | (find-files patch-dir | |
231 | "\\.diff$")))))))))))))) | |
232 | (arguments | |
233 | `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
234 | "CC=gcc") | |
235 | #:phases (modify-phases %standard-phases | |
236 | (delete 'configure) | |
237 | (add-after | |
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"))) | |
b6d937d9 EB |
243 | (symlink (string-append qemu "/bin/qemu-" ,machine) |
244 | (string-append out "/bin/afl-qemu-trace")) | |
9b459fc7 EB |
245 | #t))) |
246 | (delete 'check)))) | |
247 | (supported-systems (fold delete | |
248 | %supported-systems | |
249 | '("armhf-linux" "mips64el-linux"))) | |
250 | (home-page "http://lcamtuf.coredump.cx/afl") | |
251 | (synopsis "Security-oriented fuzzer") | |
252 | (description | |
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 | |
259 | down the road.") | |
260 | (license asl2.0)))) | |
b718bef0 EB |
261 | |
262 | (define-public stress-make | |
263 | (let ((commit "506e6cfd98d165f22bee91c408b7c20117a682c4") | |
264 | (revision "0")) ;No official source distribution | |
265 | (package | |
266 | (name "stress-make") | |
267 | (version (string-append "1.0-" revision "." (string-take commit 7))) | |
268 | (source | |
269 | (origin | |
270 | (method git-fetch) | |
271 | (uri (git-reference | |
272 | (url "https://github.com/losalamos/stress-make.git") | |
273 | (commit commit))) | |
274 | (file-name (string-append name "-" version "-checkout")) | |
275 | (sha256 | |
276 | (base32 | |
277 | "1j330yqhc7plwin04qxbh8afpg5nfnw1xvnmh8rk6mmqg9w6ik70")))) | |
278 | (build-system gnu-build-system) | |
279 | (native-inputs | |
280 | `(("autoconf" ,autoconf) | |
281 | ("automake" ,automake) | |
282 | ("go" ,go))) | |
283 | (inputs | |
284 | `(("make-source" ,(package-source gnu-make)))) | |
285 | (arguments | |
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") | |
291 | #:phases | |
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 | |
297 | (lambda _ | |
298 | (zero? (system* "tar" "cJf" "./make.tar.xz" | |
299 | (string-append "make-" | |
300 | ,(package-version gnu-make)))))) | |
301 | (add-before 'configure 'bootstrap | |
302 | (lambda _ | |
303 | (zero? (system* "autoreconf" "-vfi"))))))) | |
304 | (home-page "https://github.com/losalamos/stress-make") | |
305 | (synopsis "Expose race conditions in Makefiles") | |
306 | (description | |
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)))))) | |
660516e8 JD |
317 | |
318 | (define-public zzuf | |
319 | (package | |
320 | (name "zzuf") | |
321 | (version "0.15") | |
322 | (source | |
323 | (origin | |
324 | (method url-fetch) | |
325 | (uri (string-append | |
326 | "https://github.com/samhocevar/zzuf/releases/download/v" | |
327 | version "/" name "-" version ".tar.gz")) | |
328 | (file-name (string-append name "-" version ".tar.gz")) | |
329 | (sha256 | |
330 | (base32 | |
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/")))) |