projects/guix·blob version-0.14.0 · refs

361 lines · 16.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015, 2016, 2017 Eric Bavier <[email protected]>
3;;; Copyright © 2016, 2017 Efraim Flashner <[email protected]>
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)
24 #:use-module (guix git-download)
25 #:use-module (guix utils)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages flex)
31 #:use-module (gnu packages golang)
32 #:use-module (gnu packages indent)
33 #:use-module (gnu packages llvm)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pretty-print)
36 #:use-module (gnu packages virtualization)
37 #:use-module (ice-9 match)
38 #:use-module (srfi srfi-1))
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
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))))
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
83of their interestingness. A common such situation is when attempting to
84isolate a small failure-inducing substring of a large input that causes your
85program 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)))
89
90(define-public c-reduce
91 (package
92 (name "c-reduce")
93 (version "2.5.0")
94 (source
95 (origin
96 (method url-fetch)
97 (uri (list
98 (string-append "http://embed.cs.utah.edu/creduce/"
99 "creduce-" version ".tar.gz")))
100 (sha256
101 (base32
102 "1r23lhzq3dz8vi2dalxk5las8bf0av2w94hxxbs61pr73m77ik9d"))))
103 (build-system gnu-build-system)
104 (inputs
105 `(("astyle" ,astyle)
106 ("llvm" ,llvm)
107 ("clang" ,clang)
108 ("flex" ,flex)
109 ("indent" ,indent)
110 ("perl" ,perl)
111 ("exporter-lite" ,perl-exporter-lite)
112 ("file-which" ,perl-file-which)
113 ("getopt-tabular" ,perl-getopt-tabular)
114 ("regex-common" ,perl-regexp-common)
115 ("sys-cpu" ,perl-sys-cpu)
116 ("term-readkey" ,perl-term-readkey)))
117 (arguments
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)))))
136 (home-page "http://embed.cs.utah.edu/creduce")
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
140property of interest (such as triggering a compiler bug) and automatically
141produces a much smaller C/C++ program that has the same property. It is
142intended for use by people who discover and report bugs in compilers and other
143tools that process C/C++ code.")
144 (license ncsa)))
145
146(define qemu-2.3.0
147 (package
148 (inherit qemu-minimal)
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
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))))))))
166
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")
172 ("aarch64-linux" "aarch64")
173 ("armhf-linux" "arm")
174 ("mips64el-linux" "mips64el")
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")
180 (version "2.49b") ;It seems all releases have the 'b' suffix
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
188 "1lc8mpwlbyb1iil9961yfysp8l2l4nw0s07781m1haiz4jq2rigp"))))
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.
193 ,(package (inherit qemu-2.3.0)
194 (name "afl-qemu")
195 (inputs
196 `(("afl-src" ,source)
197 ,@(package-inputs qemu-2.3.0)))
198 ;; afl only supports using a single afl-qemu-trace executable, so
199 ;; we only build qemu for the native target.
200 (arguments
201 `(#:modules ((srfi srfi-1)
202 ,@%gnu-build-system-modules)
203 ,@(substitute-keyword-arguments (package-arguments qemu-2.3.0)
204 ((#:configure-flags config-flags)
205 ``(,(string-append "--target-list=" ,machine "-linux-user")
206 ,@(remove (λ (f) (string-prefix? "--target-list=" f))
207 ,config-flags)))
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"))
221 (install-file (string-append patch-dir
222 "/afl-qemu-cpu-inl.h")
223 ".")
224 (copy-file (string-append afl-dir "/config.h")
225 "./afl-config.h")
226 (install-file (string-append afl-dir "/types.h")
227 ".")
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)
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))))
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")))
263 (symlink (string-append qemu "/bin/qemu-" ,machine)
264 (string-append out "/bin/afl-qemu-trace"))
265 #t)))
266 (delete 'check)))) ; Tests are run during 'install phase.
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
271type of compile-time instrumentation and genetic algorithms to automatically
272discover clean, interesting test cases that trigger new internal states in the
273targeted binary. This substantially improves the functional coverage for the
274fuzzed code. The compact synthesized corpora produced by the tool are also
275useful for seeding other, more labor- or resource-intensive testing regimes
276down the road.")
277 (license asl2.0))))
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.
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))))
324 (add-after 'unpack 'bootstrap
325 (lambda _
326 (zero? (system* "autoreconf" "-vfi"))))))))
327 (home-page "https://github.com/losalamos/stress-make")
328 (synopsis "Expose race conditions in Makefiles")
329 (description
330 "Stress Make is a customized GNU Make that explicitely manages the order
331in which concurrent jobs are run to provoke erroneous behavior into becoming
332manifest. It can run jobs in the order in which they're launched, in backwards
333order, or in random order. The thought is that if code builds correctly with
334Stress Make, then it is likely that the @code{Makefile} contains no race
335conditions.")
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))))))
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
359intercepting file operations and changing random bits in the program's
360input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
361 (license (non-copyleft "http://www.wtfpl.net/txt/copying/"))))