about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--REUSE.toml14
-rw-r--r--bugs/README.md103
-rw-r--r--bugs/cve/2016/9265/34.mp3 (renamed from bugs/cve/2016/9264/globaloverflow)bin8 -> 8 bytes
-rw-r--r--bugs/cve/2016/9265/45.mp3bin0 -> 148 bytes
-rw-r--r--bugs/gnu/19784/argvbin0 -> 17 bytes
-rw-r--r--bugs/gnu/19784/limit1
-rw-r--r--bugs/gnu/25003/argvbin0 -> 21 bytes
-rw-r--r--bugs/gnu/25003/chunks1
-rw-r--r--bugs/gnu/25023/argvbin0 -> 34 bytes
-rw-r--r--bugs/gnu/25023/separator1
-rw-r--r--bugs/gnu/26545/argvbin0 -> 23 bytes
-rw-r--r--bugs/gnu/26545/size1
-rw-r--r--loftix/bugs.scm684
-rw-r--r--loftix/fuzzing.scm5
-rw-r--r--loftix/patching.scm74
-rw-r--r--loftix/transform.scm44
-rw-r--r--patches/afl++-keep-all-crashes.patch17
-rw-r--r--patches/jasper-no-define-int-types.patch19
18 files changed, 503 insertions, 461 deletions
diff --git a/REUSE.toml b/REUSE.toml
index f0dd5e5..99e95fe 100644
--- a/REUSE.toml
+++ b/REUSE.toml
@@ -43,7 +43,8 @@ SPDX-License-Identifier = 'CC0-1.0'
 
 [[annotations]]
 path = [ 'bugs/cve/2016/8691/11.crash',
-         'bugs/cve/2016/9264/globaloverflow',
+         'bugs/cve/2016/9265/34.mp3',
+         'bugs/cve/2016/9265/45.mp3',
          'bugs/cve/2016/9387/jas_matrix.jp2',
          'bugs/cve/2016/9557/signed-int-overflow.jp2',
          'bugs/cve/2016/10092/heapoverflow.tiff',
@@ -94,7 +95,7 @@ SPDX-License-Identifier = 'CC0-1.0'
 [[annotations]]
 path = [ 'bugs/cve/2017/6965/bug_3',
          'bugs/cve/2018/10372/bug3',
-         'bugs/gnu/25023/separator', ]
+         'bugs/gnu/25023/argv', ]
 SPDX-FileCopyrightText = 'Phạm Văn Thuận'
 SPDX-License-Identifier = 'CC0-1.0'
 
@@ -132,20 +133,21 @@ SPDX-FileCopyrightText = '陈鹏'
 SPDX-License-Identifier = 'CC0-1.0'
 
 [[annotations]]
-path = 'bugs/gnu/19784/limit'
+path = 'bugs/gnu/19784/argv'
 SPDX-FileCopyrightText = 'Yury Usishchev'
 SPDX-License-Identifier = 'CC0-1.0'
 
 [[annotations]]
-path = [ 'bugs/gnu/25003/chunks',
-         'bugs/gnu/26545/size' ]
+path = [ 'bugs/gnu/25003/argv',
+         'bugs/gnu/26545/argv' ]
 SPDX-FileCopyrightText = 'Pádraig Brady'
 SPDX-License-Identifier = 'CC0-1.0'
 
 [[annotations]]
 path = [ 'patches/afl++-*.patch',
          'patches/e9patch-*.patch',
-         'patches/evocatio-*.patch' ]
+         'patches/evocatio-*.patch',
+         'patches/jasper-no-define-int-types.patch' ]
 SPDX-FileCopyrightText = 'Nguyễn Gia Phong'
 SPDX-License-Identifier = 'GPL-3.0-or-later'
 
diff --git a/bugs/README.md b/bugs/README.md
index ad8de16..d0672d1 100644
--- a/bugs/README.md
+++ b/bugs/README.md
@@ -4,92 +4,92 @@
 
 - CVE-2017-6965: [heap buffer overflow][sourceware-21137]
 
-      guix shell -e '(@@ (loftix bugs) binutils-2.27-asan)'
+      guix shell binutils-with-asan@2.27
       readelf -w cve/2017/6965/bug_3
 
 - CVE-2017-14745: [integer overflow][sourceware-22148]
 
-      guix shell -e '(@@ (loftix bugs) binutils-2.29)'
+      guix shell binutils@2.29
       objdump -d cve/2017/14745/crash_1
 
 - CVE-2017-15020: [heap buffer overflow][sourceware-22202]
 
-      guix shell -e '(@@ (loftix bugs) binutils-2.29-asan)'
+      guix shell binutils-with-asan@2.29
       nm -l cve/2017/15020/reproducer
 
 - CVE-2017-15025: [division by zero][sourceware-22186]
 
-      guix shell -e '(@@ (loftix bugs) binutils-2.29)'
+      guix shell binutils@2.29
       nm -l cve/2017/15025/3899.crashes.bin
       nm -l cve/2017/15025/floatexception.elf
       objdump -S cve/2017/15025/floatexception.elf
 
 - CVE-2018-10372: [heap buffer overflow][sourceware-23064]
 
-      guix shell -e '(@@ (loftix bugs) binutils-2.30-asan)'
+      guix shell binutils-with-asan@2.30
       readelf -w cve/2018/10372/bug3
 
 - CVE-2019-9077: [heap buffer overflow][sourceware-24243]
 
-      guix shell -e '(@@ (loftix bugs) binutils-2.32-asan)'
+      guix shell binutils-with-asan@2.32
       readelf -a cve/2019/9077/hbo2
 
 ## GNU Core Utilities
 
 - #19784: [heap buffer overflow][gnu-19784]
 
-      guix shell -e '(@@ (loftix bugs) coreutils-8.23-asan)'
-      make-prime-list "$(cat gnu/19784/limit)"
+      guix shell coreutils-with-make-prime-list-with-asan@8.23
+      make-prime-list 3  # or: $(xargs -0 -a gnu/19784/argv)
 
 - #25003: [negative size param][gnu-25003]
 
-      guix shell -e '(@@ (loftix bugs) coreutils-8.26-sans-4954f79-asan)'
-      split -n"$(cat gnu/25003/chunks)" /dev/null
+      guix shell coreutils-with-asan@8.26-sans-4954f79
+      split -n2/3 /dev/null  # or: $(xargs -0 -a gnu/25003/argv)
 
 - #25023: [global buffer overflow][gnu-25023]
 
-      guix shell -e '(@@ (loftix bugs) coreutils-8.25-asan)'
-      echo | pr -m -S"$(cat gnu/25023/separator)" -t /dev/fd/0 /dev/null
+      guix shell coreutils-with-asan@8.25
+      pr -m -S"$(printf '\t\t\t')" -t /dev/null /dev/zero
 
 - #26545: [memcpy param overlap][gnu-26545]
 
-      guix shell -e '(@@ (loftix bugs) coreutils-8.27-asan)'
-      shred -n4 -s"$(cat gnu/26545/size)" /dev/null
+      guix shell coreutils-with-asan@8.27
+      shred -n4 -s7 /dev/null  # or: $(xargs -0 -a gnu/26545/argv)
 
 ## JasPer
 
 - CVE-2016-8691: [divide-by-zero][jasper-22]
 
-      guix shell -e '(@@ (loftix bugs) jasper-1.900.3)'
+      guix shell jasper@1.900.3
       imginfo -f cve/2016/8691/11.crash
 
 - CVE-2016-9387: [assertion failure][jasper-49]
 
-      guix shell -e '(@@ (loftix bugs) jasper-1.900.5)'
+      guix shell jasper@1.900.5
       imginfo -f cve/2016/9387/jas_matrix.jp2
 
 - CVE-2016-9557: [signed integer overflow][jasper-67]
 
-      guix shell -e '(@@ (loftix bugs) jasper-1.900.19)'
+      guix shell jasper-with-ubsan@1.900.19
       imginfo -f cve/2016/9557/signed-int-overflow.jp2
 
 ## libarchive
 
 - CVE-2016-5844: [signed integer overflow][libarchive-717]
 
-      guix shell -e '(@@ (loftix bugs) libarchive-3.2.0-ubsan)'
+      guix shell libarchive-with-ubsan@3.2.0
       bsdtar -tf cve/2016/5844/libarchive-signed-int-overflow.iso
 
 ## libjpeg-turbo
 
 - CVE-2012-2806: [heap buffer overflow][chromium-40058947]
 
-      guix shell -e '(@@ (loftix bugs) libjpeg-turbo-1.2.0-asan)'
+      guix shell libjpeg-turbo-with-asan@1.2.0
       djpeg cve/2012/2806/cnode0006-heap-buffer-overflow-796.jpg
 
 - CVE-2017-15232: [null pointer dereference][mozjpeg-268]
 
-      guix shell -e '(@@ (loftix bugs) libjpeg-turbo-1.5.2)'
+      guix shell libjpeg-turbo@1.5.2
       djpeg -crop "1x1+16+16" -onepass -dither ordered -dct float -colors 8\
         -targa -grayscale -outfile /dev/null cve/2017/15232/1.jpg
       djpeg -crop "1x1+16+16" -onepass -dither ordered -dct float -colors 8\
@@ -97,7 +97,7 @@
 
 - CVE-2018-14498: [heap buffer overflow][libjpeg-turbo-258]
 
-      guix shell -e '(@@ (loftix bugs) libjpeg-turbo-1.5.3-asan)'
+      guix shell libjpeg-turbo-with-asan@1.5.3
       cjpeg -outfile /dev/null cve/2018/14498/hbo_rdbmp.c:209_1.bmp
       cjpeg -outfile /dev/null cve/2018/14498/hbo_rdbmp.c:209_2.bmp
       cjpeg -outfile /dev/null cve/2018/14498/hbo_rdbmp.c:210_1.bmp
@@ -106,46 +106,47 @@
 
 - CVE-2018-19664: [heap buffer overflow][libjpeg-turbo-305]
 
-      guix shell -e '(@@ (loftix bugs) libjpeg-turbo-2.0.1-asan)'
+      guix shell libjpeg-turbo-with-asan@2.0.1
       djpeg -colors 256 -bmp cve/2018/19664/heap-buffer-overflow-2.jpg
 
 ## libming
 
-- CVE-2016-9264: [global buffer overflow][oss-sec-20161110-9]
+- CVE-2016-9265: [division by zero][oss-sec-20161110-9]
 
-      guix shell -e '(@@ (loftix bugs) libming-0.4.7-asan)'
-      listmp3 cve/2016/9264/globaloverflow
+      guix shell libming@0.4.7
+      listmp3 cve/2016/9265/34.mp3
+      listmp3 cve/2016/9265/45.mp3
 
 - CVE-2018-8806: [use after free][libming-128]
 
-      guix shell -e '(@@ (loftix bugs) libming-0.4.8-asan)'
+      guix shell libming-with-asan@0.4.8
       swftophp cve/2018/8806/heap-use-after-free.swf
 
 - CVE-2018-8964: [use after free][libming-130]
 
-      guix shell -e '(@@ (loftix bugs) libming-0.4.8-asan)'
+      guix shell libming-with-asan@0.4.8
       swftophp cve/2018/8964/heap-use-after-free.swf
 
 ## libtiff
 
 - BZ#2633: [heap buffer overflow][maptools-2633]:
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiff2ps maptools/2633/heapoverflow.tiff
 
 - CVE-2014-8128: [buffer overflow][maptools-2489]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.3)'
+      guix shell libtiff@4.0.3
       thumbnail cve/2014/8128/03_thumbnail.tiff /dev/null
 
 - CVE-2016-3186: [buffer overflow][redhat-1319503]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.6)'
-      echo y | gif2tiff cve/2016/3186/crash.gif /dev/null
+      guix shell libtiff@4.0.6
+      gif2tiff cve/2016/3186/crash.gif -
 
 - CVE-2016-3623: [division by zero][maptools-2569]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.6)'
+      guix shell libtiff@4.0.6
       tar xvf $(guix build -S libtiff@4.0.6)\
         tiff-4.0.6/test/images/logluv-3c-16b.tiff
       rgb2ycbcr -h 0 tiff-4.0.6/test/images/logluv-3c-16b.tiff /dev/null
@@ -153,37 +154,37 @@
 
 - CVE-2016-5314: [heap buffer overflow][maptools-2554]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.6-asan)'
+      guix shell libtiff-with-asan@4.0.6
       rgb2ycbcr cve/2016/5314/oobw.tiff /dev/null
 
 - CVE-2016-5321: [invalid read][maptools-2558]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.6)'
+      guix shell libtiff@4.0.6
       tiffcrop cve/2016/5321/ill-read.tiff /dev/null
 
 - CVE-2016-9273: [heap buffer overflow][maptools-2587]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.6-asan)'
+      guix shell libtiff-with-asan@4.0.6
       tiffsplit cve/2016/9273/test049.tiff
 
 - CVE-2016-9532: [heap buffer overflow][maptools-2592]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.6)'
+      guix shell libtiff-with-asan@4.0.6
       tiffcrop cve/2016/9532/heap-buffer-overflow.tiff /dev/null
 
 - CVE-2016-10092: [heap buffer overflow][maptools-2622]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiffcrop -i cve/2016/10092/heapoverflow.tiff /dev/null
 
 - CVE-2016-10093: [heap buffer overflow][maptools-2610]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiffcp -i cve/2016/10093/heapoverflow.tiff /dev/null
 
 - CVE-2016-10094: [heap buffer overflow][maptools-2640]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiff2pdf cve/2016/10094/heapoverflow.tiff -o /dev/null
 
 - CVE-2016-10266: [division by zero][maptools-2596]
@@ -198,65 +199,65 @@
 
 - CVE-2016-10268: [heap buffer overflow][maptools-2598]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiffcp -i cve/2016/10268/heapoverflow.tiff /dev/null
 
 - CVE-2016-10271: [heap buffer overflow][maptools-2620]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiffcrop -i cve/2016/10271/heapoverflow.tiff /dev/null
 
 - CVE-2016-10272: [heap buffer overflow][maptools-2624]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiffcrop -i cve/2016/10272/heapoverflow.tiff /dev/null
 
 - CVE-2017-5225: [heap buffer overflow][maptools-2656]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-asan)'
+      guix shell libtiff-with-asan@4.0.7
       tiffcp -p separate cve/2017/5225/2656.tiff /dev/null
       tiffcp -p contig cve/2017/5225/2657.tiff /dev/null
 
 - CVE-2017-7595: [division by zero][maptools-2653]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7)'
+      guix shell libtiff@4.0.7
       tiffcp -i cve/2017/7595/fpe.tiff /dev/null
 
 - cve-2017-7599: [float cast overflow][maptools-2646]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-ubsan-float-cast-overflow)'
+      guix shell libtiff-with-ubsan-float-cast-overflow@4.0.7
       tiffcp -i cve/2017/7599/outside-short.tiff /dev/null
 
 - cve-2017-7600: [float cast overflow][maptools-2647]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-ubsan-float-cast-overflow)'
+      guix shell libtiff-with-ubsan-float-cast-overflow@4.0.7
       tiffcp -i cve/2017/7600/outside-unsigned-char.tiff /dev/null
 
 - CVE-2017-7601: [signed integer overflow][maptools-2648]
 
-      guix shell -e '(@@ (loftix bugs) libtiff-4.0.7-ubsan)'
+      guix shell libtiff-with-ubsan@4.0.7
       tiffcp -i cve/2017/7601/shift-long.tiff /dev/null
 
 ## libxml2
 
 - CVE-2012-5134: [heap buffer overflow][chromium-40076524]
 
-      guix shell -e '(@@ (loftix bugs) libxml2-2.9.0-asan)'
+      guix shell libxml2-with-asan@2.9.0
       xmllint cve/2012/5134/bad.xml
 
 - CVE-2016-1838: [heap buffer overflow][chromium-42452154]
 
-      guix shell -e '(@@ (loftix bugs) libxml2-2.9.3-asan)'
+      guix shell libxml2-with-asan@2.9.3
       xmllint cve/2016/1838/attachment_316158
 
 - CVE-2016-1839: [heap buffer overflow][chromium-42452152]
 
-      guix shell -e '(@@ (loftix bugs) libxml2-2.9.3-asan)'
+      guix shell libxml2-with-asan@2.9.3
       xmllint --html cve/2016/1839/asan_heap-oob
 
 - CVE-2017-5969: [null pointer derefence][oss-sec-20161105-3]
 
-      guix shell -e '(@@ (loftix bugs) libxml2-2.9.4
+      guix shell libxml2@2.9.4
       xmllint --recover cve/2017/5969/crash-libxml2-recover.xml
 
 ## potrace
diff --git a/bugs/cve/2016/9264/globaloverflow b/bugs/cve/2016/9265/34.mp3
index 24f6f72..24f6f72 100644
--- a/bugs/cve/2016/9264/globaloverflow
+++ b/bugs/cve/2016/9265/34.mp3
Binary files differdiff --git a/bugs/cve/2016/9265/45.mp3 b/bugs/cve/2016/9265/45.mp3
new file mode 100644
index 0000000..2c30b61
--- /dev/null
+++ b/bugs/cve/2016/9265/45.mp3
Binary files differdiff --git a/bugs/gnu/19784/argv b/bugs/gnu/19784/argv
new file mode 100644
index 0000000..cc212c7
--- /dev/null
+++ b/bugs/gnu/19784/argv
Binary files differdiff --git a/bugs/gnu/19784/limit b/bugs/gnu/19784/limit
deleted file mode 100644
index e440e5c..0000000
--- a/bugs/gnu/19784/limit
+++ /dev/null
@@ -1 +0,0 @@
-3
\ No newline at end of file
diff --git a/bugs/gnu/25003/argv b/bugs/gnu/25003/argv
new file mode 100644
index 0000000..fce27bd
--- /dev/null
+++ b/bugs/gnu/25003/argv
Binary files differdiff --git a/bugs/gnu/25003/chunks b/bugs/gnu/25003/chunks
deleted file mode 100644
index ffe913b..0000000
--- a/bugs/gnu/25003/chunks
+++ /dev/null
@@ -1 +0,0 @@
-2/3
\ No newline at end of file
diff --git a/bugs/gnu/25023/argv b/bugs/gnu/25023/argv
new file mode 100644
index 0000000..ad45798
--- /dev/null
+++ b/bugs/gnu/25023/argv
Binary files differdiff --git a/bugs/gnu/25023/separator b/bugs/gnu/25023/separator
deleted file mode 100644
index bbeba64..0000000
--- a/bugs/gnu/25023/separator
+++ /dev/null
@@ -1 +0,0 @@
-			
\ No newline at end of file
diff --git a/bugs/gnu/26545/argv b/bugs/gnu/26545/argv
new file mode 100644
index 0000000..427d8f7
--- /dev/null
+++ b/bugs/gnu/26545/argv
Binary files differdiff --git a/bugs/gnu/26545/size b/bugs/gnu/26545/size
deleted file mode 100644
index c793025..0000000
--- a/bugs/gnu/26545/size
+++ /dev/null
@@ -1 +0,0 @@
-7
\ No newline at end of file
diff --git a/loftix/bugs.scm b/loftix/bugs.scm
index c9466e7..db5f911 100644
--- a/loftix/bugs.scm
+++ b/loftix/bugs.scm
@@ -22,6 +22,7 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages xml)
+  #:use-module (guix build-system)
   #:use-module (guix build-system gnu)
   #:use-module (guix download)
   #:use-module (guix gexp)
@@ -30,195 +31,223 @@
   #:use-module (guix packages)
   #:use-module (guix utils))
 
-(define-public binutils-2.32-asan
+(define (at-version base version uri checksum)
   (package
-    (inherit binutils-2.33)
-    (version "2.32")
-    (source (origin
-              (inherit (package-source binutils))
-              (uri (string-append "mirror://gnu/binutils/binutils-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32 "0b8767nyal1bc4cyzg5h9iis8kpkln1i3wkamig75cifj1fb2f6y"))
-              (patches '())))
-    (arguments '(#:phases (modify-phases %standard-phases
-                            (add-before 'build 'set-env
-                              (lambda _
-                                (setenv "ASAN_OPTIONS" "detect_leaks=0"))))
-                 #:make-flags '("CFLAGS=-O2 -g -fsanitize=address"
-                                "LDFLAGS=-fsanitize=address")))))
-
-(define-public binutils-2.30-asan
-  (package
-    (inherit binutils-2.32-asan)
-    (version "2.30")
-    (source (origin
-              (inherit (package-source binutils))
-              (uri (string-append "mirror://gnu/binutils/binutils-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32 "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg"))
-              (patches '())))))
+    (inherit base)
+    (version version)
+    (source
+     (let ((src (package-source base)))
+       (origin
+         (inherit src)
+         (uri uri)
+         (sha256 (base32 checksum))
+         (file-name (cond ((eq? (origin-method src) git-fetch)
+                           (git-file-name (package-name base) version))
+                          ((eq? (origin-method src) url-fetch)
+                           (origin-file-name src)))))))))
 
-(define-public binutils-2.29-asan
-  (package
-    (inherit binutils-2.32-asan)
-    (version "2.29")
-    (source (origin
-              (inherit (package-source binutils))
-              (uri (string-append "mirror://gnu/binutils/binutils-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32 "1gqfyksdnj3iir5gzyvlp785mnk60g1pll6zbzbslfchhr4rb8i9"))
-              (patches '())))))
+(define (binutils-at-version base version checksum)
+  (at-version
+   (package
+     (inherit base)
+     (source
+      (origin
+        (inherit (package-source base))
+        (patches '()))))
+   version
+   (string-append "mirror://gnu/binutils/binutils-" version ".tar.bz2")
+   checksum))
+
+(define-public binutils-2.32
+  (binutils-at-version
+   binutils-2.33
+   "2.32"
+   "0b8767nyal1bc4cyzg5h9iis8kpkln1i3wkamig75cifj1fb2f6y"))
+
+(define-public binutils-2.30
+  (binutils-at-version
+   binutils-2.33
+   "2.30"
+   "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg"))
 
 (define-public binutils-2.29
-  (package
-    (inherit binutils-2.33)
-    (version "2.29")
-    (source (origin
-              (inherit (package-source binutils))
-              (uri (string-append "mirror://gnu/binutils/binutils-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32 "1gqfyksdnj3iir5gzyvlp785mnk60g1pll6zbzbslfchhr4rb8i9"))
-              (patches '())))))
+  (binutils-at-version
+   binutils-2.33
+   "2.29"
+   "1gqfyksdnj3iir5gzyvlp785mnk60g1pll6zbzbslfchhr4rb8i9"))
+
+(define-public binutils-2.27
+  (binutils-at-version
+   binutils-2.33
+   "2.27"
+   "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn"))
 
-(define-public binutils-2.27-asan
+(define (with-asan base)
   (package
-    (inherit binutils-2.29-asan)
-    (version "2.27")
-    (source (origin
-              (inherit (package-source binutils))
-              (uri (string-append "mirror://gnu/binutils/binutils-"
-                                  version ".tar.bz2"))
-              (sha256
-               (base32 "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn"))
-              (patches '())))))
+    (inherit base)
+    (name (string-append (package-name base) "-with-asan"))
+    (arguments
+     (case (build-system-name (package-build-system base))
+       ((cmake)
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:phases phases #~%standard-phases)
+           (with-imported-modules '((loftix transform))
+             #~(modify-phases #$phases
+                 (add-before 'configure 'set-env
+                   (lambda _
+                     (use-modules (loftix transform))
+                     (append-env "CFLAGS" "-fsanitize=address" "-O2 -g")
+                     (append-env "LDFLAGS" "-fsanitize=address" #f)
+                     (setenv "ASAN_OPTIONS" "detect_leaks=0"))))))
+          ((#:tests? _ #f)
+           #f)))
+       ((gnu)
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:make-flags flags #~'())
+           (with-imported-modules '((loftix transform))
+             #~((@ (loftix transform) append-make-flag)
+                #$flags
+                '(("CFLAGS" "-fsanitize=address" "-O2 -g")
+                  ("LDFLAGS" "-fsanitize=address")))))
+          ((#:phases phases #~%standard-phases)
+           #~(modify-phases #$phases
+               (add-before 'build 'set-env
+                 (lambda _
+                   (setenv "ASAN_OPTIONS" "detect_leaks=0")))))
+          ((#:tests? _ #f)
+           #f)))))))
+
+(define-public binutils-with-asan-2.32 (with-asan binutils-2.32))
+(define-public binutils-with-asan-2.30 (with-asan binutils-2.30))
+(define-public binutils-with-asan-2.29 (with-asan binutils-2.29))
+(define-public binutils-with-asan-2.27 (with-asan binutils-2.27))
 
-(define-public coreutils-8.27-asan
+(define-public coreutils-8.27
   (package
     (inherit coreutils)
     (version "8.27")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/coreutils/coreutils-"
-                                  version ".tar.xz"))
-              (sha256
-               (base32
-                "0sv547572iq8ayy8klir4hnngnx92a9nsazmf1wgzfc7xr4x74c8"))
-              (patches
-               (search-patches "patches/coreutils-gnulib-glibc-2.28.patch"))))
-    (arguments
-      (substitute-keyword-arguments (package-arguments coreutils)
-        ((#:make-flags flags #~'())
-         #~(cons* "CFLAGS=-O2 -g -fsanitize=address"
-                  "LDFLAGS=-fsanitize=address"
-                  #$flags))
-        ((#:phases phases #~%standard-phases)
-         #~(modify-phases #$phases
-            (add-before 'build 'set-env
-             (lambda _ (setenv "ASAN_OPTIONS" "detect_leaks=0")))))
-        ((#:tests? _ #f)
-         #f)))))
-
-(define-public coreutils-8.26-sans-4954f79-asan
-  (package
-    (inherit coreutils-8.27-asan)
-    (version "8.26")
-    (source (origin
-              (inherit (package-source coreutils-8.27-asan))
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/coreutils/coreutils-"
-                                  version ".tar.xz"))
-              (sha256
-               (base32
-                "13lspazc7xkviy93qz7ks9jv4sldvgmwpq36ghrbrqpq93br8phm"))
-              (patches (cons (search-patch
-                              "patches/bugs/coreutils-unfix-bug-25003.patch")
-                             (origin-patches
-                              (package-source coreutils-8.27-asan))))))))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://gnu/coreutils/coreutils-" version
+                           ".tar.xz"))
+       (sha256 (base32 "0sv547572iq8ayy8klir4hnngnx92a9nsazmf1wgzfc7xr4x74c8"))
+       (patches (search-patches
+                 "patches/coreutils-gnulib-glibc-2.28.patch"))))))
 
-(define-public coreutils-8.25-asan
-  (package
-    (inherit coreutils-8.27-asan)
-    (version "8.25")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/coreutils/coreutils-"
-                                  version ".tar.xz"))
-              (sha256
-               (base32
-                "11yfrnb94xzmvi4lhclkcmkqsbhww64wf234ya1aacjvg82prrii"))
-              (patches (search-patches
-                        "patches/coreutils-gnulib-glibc-2.25.patch"
-                        "patches/coreutils-gnulib-glibc-2.28.patch"))))))
+(define-public coreutils-with-asan-8.27 (with-asan coreutils-8.27))
+
+(define (coreutils-at-version base version checksum)
+  (at-version
+   base
+   version
+   (string-append "mirror://gnu/coreutils/coreutils-" version ".tar.xz")
+   checksum))
 
-(define-public coreutils-8.23-asan
+(define-public coreutils-8.26
+  (coreutils-at-version
+   coreutils-8.27
+   "8.26"
+   "13lspazc7xkviy93qz7ks9jv4sldvgmwpq36ghrbrqpq93br8phm"))
+
+(define (with-patches base . patches)
   (package
-    (inherit coreutils-8.25-asan)
-    (version "8.23")
-    (source (origin
-              (inherit (package-source coreutils-8.25-asan))
-              (uri (string-append "mirror://gnu/coreutils/coreutils-"
-                                  version ".tar.xz"))
-              (sha256
-               (base32
-                "0bdq6yggyl7nkc2pbl6pxhhyx15nyqhz3ds6rfn448n6rxdwlhzc"))))
-    (arguments
-      (substitute-keyword-arguments (package-arguments coreutils-8.25-asan)
-        ((#:phases phases #~%standard-phases)
-         #~(modify-phases #$phases
-            (add-after 'install 'install-make-prime-list
-             (lambda* (#:key outputs #:allow-other-keys)
-               (install-file
-                "src/make-prime-list"
-                (string-append (assoc-ref outputs "out") "/bin"))))))))))
+    (inherit base)
+    (source
+     (origin
+       (inherit (package-source base))
+       (patches (append (origin-patches (package-source base))
+                        (map search-patch patches)))))))
 
-(define-public jasper-1.900.19
-  ;; FIXME: UBSan somehow breaks build phase.
+(define coreutils-8.26-sans-4954f79
+  (with-patches (package
+                  (inherit coreutils-8.26)
+                  (version "8.26-sans-4954f79"))
+                "patches/bugs/coreutils-unfix-bug-25003.patch"))
+
+(define-public coreutils-with-asan-8.26-sans-4954f79
+  (with-asan coreutils-8.26-sans-4954f79))
+
+(define-public coreutils-8.25
+  (with-patches
+   (coreutils-at-version
+    coreutils-8.27
+    "8.25"
+    "11yfrnb94xzmvi4lhclkcmkqsbhww64wf234ya1aacjvg82prrii")
+   "patches/coreutils-gnulib-glibc-2.25.patch"))
+
+(define-public coreutils-with-asan-8.25 (with-asan coreutils-8.25))
+
+(define-public coreutils-8.23
+  (coreutils-at-version
+    coreutils-8.25
+    "8.23"
+    "0bdq6yggyl7nkc2pbl6pxhhyx15nyqhz3ds6rfn448n6rxdwlhzc"))
+
+(define-public coreutils-with-make-prime-list-with-asan-8.23
+  (let ((base (with-asan coreutils-8.23)))
+    (package
+      (inherit base)
+      (name "coreutils-with-make-prime-list-with-asan")
+      (arguments
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:phases phases #~%standard-phases)
+           #~(modify-phases #$phases
+              (add-after 'install 'install-make-prime-list
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (install-file
+                  "src/make-prime-list"
+                  (string-append (assoc-ref outputs "out") "/bin")))))))))))
+
+(define (jasper-at-version version checksum)
   (package
     (inherit jasper)
-    (name "jasper")
-    (version "1.900.19")
+    (version version)
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper"
                                   "/software/jasper-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0dm3k0wdny3s37zxm9s9riv46p69c14bnn532fv6cv5b6l1b0pwb"))))
+              (sha256 (base32 checksum))
+              (patches (search-patches
+                        "patches/jasper-no-define-int-types.patch"))))
     (build-system gnu-build-system)
     (inputs (list ijg-libjpeg))))
 
-(define-public jasper-1.900.5
+(define-public jasper-1.900.19
+  (jasper-at-version "1.900.19"
+                     "0dm3k0wdny3s37zxm9s9riv46p69c14bnn532fv6cv5b6l1b0pwb"))
+
+(define (with-ubsan base)
   (package
-    (inherit jasper-1.900.19)
-    (name "jasper")
-    (version "1.900.5")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper"
-                                  "/software/jasper-" version ".tar.gz"))
-              (sha256
-               (base32
-                "1fvy4ngc6064g128q4484qpinsn05y9qw6lrccc4czhalla2w26m"))))))
+    (inherit base)
+    (name (string-append (package-name base) "-with-ubsan"))
+    (arguments
+     (case (build-system-name (package-build-system base))
+       ((gnu)
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:make-flags flags #~'())
+           (with-imported-modules '((loftix transform))
+             #~((@ (loftix transform) append-make-flag)
+                #$flags
+                '(("CFLAGS"
+                   "-fsanitize=undefined -fno-sanitize-recover=undefined"
+                   "-O2 -g")
+                  ("LDFLAGS" "-fsanitize=undefined")))))
+          ((#:tests? _ #f)
+           #f)))))))
+
+(define-public jasper-with-ubsan-1.900.19
+  (with-ubsan jasper-1.900.19))
+
+(define-public jasper-1.900.5
+  (jasper-at-version "1.900.5"
+                     "1fvy4ngc6064g128q4484qpinsn05y9qw6lrccc4czhalla2w26m"))
 
 (define-public jasper-1.900.3
-  (package
-    (inherit jasper-1.900.19)
-    (name "jasper")
-    (version "1.900.3")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper"
-                                  "/software/jasper-" version ".tar.gz"))
-              (sha256
-               (base32
-                "106xwiyn40k5yrnny198mzscvyd18rza9clhd2nl6xvcsz73swrn"))))
-    (arguments '(#:make-flags '("LDFLAGS=-static")))))
+  (jasper-at-version "1.900.3"
+                     "106xwiyn40k5yrnny198mzscvyd18rza9clhd2nl6xvcsz73swrn"))
 
-(define-public libarchive-3.2.0-ubsan
+(define-public libarchive-3.2.0
   (package
     (inherit libarchive)
     (name "libarchive")
@@ -229,79 +258,53 @@
                                   version ".tar.gz"))
               (sha256
                (base32 "11xabdpmvdmcdkidigmqh4ymhra95lr7ipcys4hdq0gzf7ylbkkv"))
-              (patches '())))
-    (arguments '(#:make-flags
-                 (list (string-append "CFLAGS=-O2 -g"
-                                      " -fsanitize=undefined"
-                                      " -fno-sanitize-recover=undefined")
-                       "LDFLAGS=-fsanitize=undefined")
-                 ;; Tests fail with UBSan enabled^
-                 #:tests? #f))))
+              (patches '())))))
+
+(define-public libarchive-with-ubsan-3.2.0
+  (with-ubsan libarchive-3.2.0))
+
+(define (libjpeg-turbo-at-version base version checksum)
+  (at-version
+   base
+   version
+   (string-append "mirror://sourceforge/libjpeg-turbo/" version
+                  "/libjpeg-turbo-" version ".tar.gz")
+   checksum))
+
+(define-public libjpeg-turbo-2.0.1
+  (libjpeg-turbo-at-version
+   libjpeg-turbo
+   "2.0.1"
+   "1zv6z093l3x3jzygvni7b819j7xhn6d63jhcdrckj7fz67n6ry75"))
+
+(define-public libjpeg-turbo-1.5.3
+  (libjpeg-turbo-at-version
+   (package
+     (inherit libjpeg-turbo)
+     (build-system gnu-build-system)
+     (arguments
+      (substitute-keyword-arguments (package-arguments libjpeg-turbo)
+        ((#:configure-flags _) #~'())))) ;discard CMake flags
+   "1.5.3"
+   "08r5b5mywwrxv4axvq80dm31cklz81grczlzlxr2xqa6pgi90j5j"))
 
 (define-public libjpeg-turbo-1.5.2
-  (package
-    (inherit libjpeg-turbo)
-    (name "libjpeg-turbo")
-    (version "1.5.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libjpeg-turbo/"
-                                  version "/libjpeg-turbo-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0a5m0psfp5952y5vrcs0nbdz1y9wqzg2ms0xwrx752034wxr964h"))))
-    (build-system gnu-build-system)
-    (arguments '(#:make-flags '("LDFLAGS=-static")
-                 #:test-target "test"))))
+  (libjpeg-turbo-at-version
+   libjpeg-turbo-1.5.3
+   "1.5.2"
+   "0a5m0psfp5952y5vrcs0nbdz1y9wqzg2ms0xwrx752034wxr964h"))
 
-(define-public libjpeg-turbo-1.5.3-asan
-  (package
-    (inherit libjpeg-turbo-1.5.2)
-    (name "libjpeg-turbo")
-    (version "1.5.3")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libjpeg-turbo/"
-                                  version "/libjpeg-turbo-" version ".tar.gz"))
-              (sha256
-               (base32
-                "08r5b5mywwrxv4axvq80dm31cklz81grczlzlxr2xqa6pgi90j5j"))))
-    (arguments '(#:make-flags '("CFLAGS=-O2 -g -fsanitize=address"
-                                "LDFLAGS=-static -fsanitize=address")))))
+(define-public libjpeg-turbo-1.2.0
+  (libjpeg-turbo-at-version
+   libjpeg-turbo-1.5.3
+   "1.2.0"
+   "13pra36wn2djw2aq5vvbaf81m9jxdjixvpd8bw71nni9n6lv57b2"))
 
-(define-public libjpeg-turbo-1.2.0-asan
-  (package
-    (inherit libjpeg-turbo-1.5.3-asan)
-    (name "libjpeg-turbo")
-    (version "1.2.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libjpeg-turbo/"
-                                  version "/libjpeg-turbo-" version ".tar.gz"))
-              (sha256
-               (base32
-                "13pra36wn2djw2aq5vvbaf81m9jxdjixvpd8bw71nni9n6lv57b2"))))))
+(define-public libjpeg-turbo-with-asan-2.0.1 (with-asan libjpeg-turbo-2.0.1))
+(define-public libjpeg-turbo-with-asan-1.5.3 (with-asan libjpeg-turbo-1.5.3))
+(define-public libjpeg-turbo-with-asan-1.2.0 (with-asan libjpeg-turbo-1.2.0))
 
-(define-public libjpeg-turbo-2.0.1-asan
-  (package
-    (inherit libjpeg-turbo)
-    (name "libjpeg-turbo")
-    (version "2.0.1")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://sourceforge/libjpeg-turbo/"
-                                  version "/libjpeg-turbo-" version ".tar.gz"))
-              (sha256
-               (base32
-                "1zv6z093l3x3jzygvni7b819j7xhn6d63jhcdrckj7fz67n6ry75"))))
-    (arguments '(#:phases (modify-phases %standard-phases
-                            (add-before 'configure 'set-env
-                              (lambda _
-                                (setenv "CFLAGS" "-O2 -g -fsanitize=address")
-                                (setenv "LDFLAGS" "-fsanitize=address"))))
-                 #:configure-flags '("-DCMAKE_INSTALL_LIBDIR:PATH=lib")))))
-
-(define-public libming-0.4.8-asan
+(define-public libming-0.4.8
   (package
     (name "libming")
     (version "0.4.8")
@@ -316,8 +319,7 @@
               (patches (search-patches
                          "patches/libming-parallel-make.patch"))))
     (build-system gnu-build-system)
-    (arguments '(#:make-flags '("CFLAGS=-O2 -g -fcommon -fsanitize=address"
-                                "LDFLAGS=-static -fsanitize=address")
+    (arguments '(#:make-flags '("CFLAGS=-O2 -g -fcommon")
                  #:tests? #f))
     (native-inputs (list autoconf automake bison flex libtool pkgconf swig))
     (inputs (list freetype giflib libpng))
@@ -327,54 +329,26 @@ It can be used from PHP, Perl, Ruby, Python, C, C++ and Java.")
     (home-page "https://github.com/libming/libming")
     (license (list license:lgpl2.1+ license:gpl2+))))
 
-(define-public libming-0.4.7-asan
-  (package
-    (inherit libming-0.4.8-asan)
-    (name "libming")
-    (version "0.4.7")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/libming/libming")
-                    (commit "ming-0_4_7")))
-              (sha256
-               (base32 "17ngz1n1mnknixzchywkhbw9s3scad8ajmk97gx14xbsw1603gd2"))
-              (file-name (git-file-name name version))
-              (patches (search-patches
-                         "patches/libming-parallel-make.patch"))))))
+(define-public libming-with-asan-0.4.8
+  (with-asan libming-0.4.8))
 
-(define-public libtiff-4.0.3
-  (package
-    (inherit libtiff)
-    (version "4.0.3")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "ftp://ftp.remotesensing.org/pub/libtiff/tiff-"
-                    version ".tar.gz"))
-             (sha256
-              (base32 "0wj8d1iwk9vnpax2h29xqc2hwknxg3s0ay2d5pxkg59ihbifn6pa"))))
-    (outputs '("out"))))
+(define (libming-at-version base version checksum)
+  (at-version
+   base
+   version
+   (git-reference
+    (url "https://github.com/libming/libming")
+    (commit (string-append "ming-"
+                           (string-map (lambda (char)
+                                         (if (eq? char #\.) #\_ char))
+                                       version))))
+   checksum))
 
-(define-public libtiff-4.0.6
-  (package
-    (inherit libtiff)
-    (version "4.0.6")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                     "ftp://ftp.remotesensing.org/pub/libtiff/tiff-" version
-                     ".tar.gz"))
-              (sha256
-               (base32
-                "136nf1rj9dp5jgv1p7z4dk0xy3wki1w0vfjbk82f645m0w4samsd"))))
-    (arguments '(#:make-flags '("LDFLAGS=-static")))
-    (outputs '("out"))))
-
-(define-public libtiff-4.0.6-asan
-  (package
-    (inherit libtiff-4.0.6)
-    (arguments '(#:make-flags '("CFLAGS=-O2 -g -fsanitize=address"
-                                "LDFLAGS=-static -fsanitize=address")))))
+(define-public libming-0.4.7
+  (libming-at-version
+   libming-0.4.8
+   "0.4.7"
+   "17ngz1n1mnknixzchywkhbw9s3scad8ajmk97gx14xbsw1603gd2"))
 
 (define-public libtiff-4.0.7
   (package
@@ -389,84 +363,92 @@ It can be used from PHP, Perl, Ruby, Python, C, C++ and Java.")
                 "06ghqhr4db1ssq0acyyz49gr8k41gzw6pqb6mbn5r7jqp77s4hwz"))))
     (outputs '("out"))))
 
-(define-public libtiff-4.0.7-asan
-  (package
-    (inherit libtiff-4.0.7)
-    (arguments '(#:make-flags '("CFLAGS=-O2 -g -fsanitize=address"
-                                "LDFLAGS=-static -fsanitize=address")))))
+(define (libtiff-at-version base version checksum)
+  (at-version
+   base
+   version
+   (string-append
+    "ftp://ftp.remotesensing.org/pub/libtiff/tiff-" version ".tar.gz")
+   checksum))
 
-(define-public libtiff-4.0.7-ubsan
-  (package
-    (inherit libtiff-4.0.7)
-    (arguments '(#:make-flags
-                 (list (string-append
-                         "CFLAGS=-O2 -g -fsanitize=undefined"
-                         " -fno-sanitize-recover=undefined")
-                       "LDFLAGS=-static -fsanitize=undefined")
-                 ;; Tests fail with ubsan enabled^
-                 #:tests? #f))))
-
-(define-public libtiff-4.0.7-ubsan-float-cast-overflow
+(define-public libtiff-4.0.6
+  (libtiff-at-version
+   libtiff-4.0.7
+   "4.0.6"
+   "136nf1rj9dp5jgv1p7z4dk0xy3wki1w0vfjbk82f645m0w4samsd"))
+
+(define-public libtiff-4.0.3
+  (libtiff-at-version
+   libtiff-4.0.7
+   "4.0.3"
+   "0wj8d1iwk9vnpax2h29xqc2hwknxg3s0ay2d5pxkg59ihbifn6pa"))
+
+(define-public libtiff-with-asan-4.0.7 (with-asan libtiff-4.0.7))
+(define-public libtiff-with-asan-4.0.6 (with-asan libtiff-4.0.6))
+(define-public libtiff-with-ubsan-4.0.7 (with-ubsan libtiff-4.0.7))
+
+(define (with-ubsan-float-cast-overflow base)
   (package
-    (inherit libtiff-4.0.7)
-    (arguments '(#:make-flags
-                 (list (string-append
-                         "CFLAGS=-O2 -g -fsanitize=float-cast-overflow"
-                         " -fno-sanitize-recover=float-cast-overflow")
-                       "LDFLAGS=-static -fsanitize=float-cast-overflow")))))
+    (inherit base)
+    (name (string-append (package-name base)
+                         "-with-ubsan-float-cast-overflow"))
+    (arguments
+     (case (build-system-name (package-build-system base))
+       ((gnu)
+        (substitute-keyword-arguments (package-arguments base)
+          ((#:make-flags flags #~'())
+           (with-imported-modules '((loftix transform))
+             #~((@ (loftix transform) append-make-flag)
+                #$flags
+                `(("CFLAGS"
+                   ,(string-append
+                     "-fsanitize=float-cast-overflow"
+                     " -fno-sanitize-recover=float-cast-overflow")
+                   "-O2 -g")
+                  ("LDFLAGS" "-fsanitize=float-cast-overflow")))))
+          ((#:tests? _ #f)
+           #f)))))))
+
+(define-public libtiff-with-ubsan-float-cast-overflow-4.0.7
+  (with-ubsan-float-cast-overflow libtiff-4.0.7))
+
+(define (libxml2-at-version base version checksum)
+  (at-version
+   base
+   version
+   (string-append "ftp://xmlsoft.org/libxml2/libxml2-" version ".tar.gz")
+   checksum))
 
 (define-public libxml2-2.9.4
-  (package
-    (inherit libxml2)
-    (name "libxml2")
-    (version "2.9.4")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "ftp://xmlsoft.org/libxml2/libxml2-"
-                                  version ".tar.gz"))
-              (sha256
-               (base32
-                "0g336cr0bw6dax1q48bblphmchgihx9p1pjmxdnrd6sh3qci3fgz"))))
-    (arguments '(#:make-flags '("LDFLAGS=-static")))
-    ;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml'
-    ;; sub-directory of any given package.
-    (native-search-paths (list (search-path-specification
-                                (variable "XML_CATALOG_FILES")
-                                (separator " ")
-                                (files '("xml"))
-                                (file-pattern "^catalog\\.xml$")
-                                (file-type 'regular))))
-    (search-paths native-search-paths)))
-
-(define-public libxml2-2.9.3-asan
-  (package
-    (inherit libxml2-2.9.4)
-    (name "libxml2")
-    (version "2.9.3")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "ftp://xmlsoft.org/libxml2/libxml2-"
-                                  version ".tar.gz"))
-              (sha256
-               (base32
-                "0bd17g6znn2r98gzpjppsqjg33iraky4px923j3k8kdl8qgy7sad"))))
-    (arguments '(#:make-flags '("CFLAGS=-O2 -g -fsanitize=address"
-                                "LDFLAGS=-static -fsanitize=address")
-                 ;; Tests fail with ASan enabled^
-                 #:tests? #f))))
+  (libxml2-at-version
+   (package
+     (inherit libxml2)
+     ;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml'
+     ;; sub-directory of any given package.
+     (native-search-paths (list (search-path-specification
+                                 (variable "XML_CATALOG_FILES")
+                                 (separator " ")
+                                 (files '("xml"))
+                                 (file-pattern "^catalog\\.xml$")
+                                 (file-type 'regular))))
+     (search-paths native-search-paths))
+   "2.9.4"
+   "0g336cr0bw6dax1q48bblphmchgihx9p1pjmxdnrd6sh3qci3fgz"))
 
-(define-public libxml2-2.9.0-asan
-  (package
-    (inherit libxml2-2.9.3-asan)
-    (name "libxml2")
-    (version "2.9.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "ftp://xmlsoft.org/libxml2/libxml2-"
-                                  version ".tar.gz"))
-              (sha256
-               (base32
-                "10ib8bpar2pl68aqksfinvfmqknwnk7i35ibq6yjl8dpb0cxj9dd"))))))
+(define-public libxml2-2.9.3
+  (libxml2-at-version
+   libxml2-2.9.4
+   "2.9.3"
+   "0bd17g6znn2r98gzpjppsqjg33iraky4px923j3k8kdl8qgy7sad"))
+
+(define-public libxml2-2.9.0
+  (libxml2-at-version
+   libxml2-2.9.4
+   "2.9.0"
+   "10ib8bpar2pl68aqksfinvfmqknwnk7i35ibq6yjl8dpb0cxj9dd"))
+
+(define-public libxml2-with-asan-2.9.3 (with-asan libxml2-2.9.3))
+(define-public libxml2-with-asan-2.9.0 (with-asan libxml2-2.9.0))
 
 (define-public potrace-1.11
   (package
diff --git a/loftix/fuzzing.scm b/loftix/fuzzing.scm
index 6e904ae..6ec3a35 100644
--- a/loftix/fuzzing.scm
+++ b/loftix/fuzzing.scm
@@ -64,9 +64,8 @@
                  (base32
                   "16kc2xa4dk9lq1sg7sl5489n7r3p8kc6hmfgy0gh7i1n6h269bry"))
                 (patches
-                 (search-patches "patches/evocatio-argv-fuzz-amd64-only.patch"))))
-                ;;(patches
-                ;; (search-patches "patches/evocatio-keep-all-crashes.patch"))))
+                 (search-patches
+                   "patches/evocatio-argv-fuzz-amd64-only.patch"))))
       (arguments
         (substitute-keyword-arguments (package-arguments aflplusplus)
           ((#:make-flags make-flags)
diff --git a/loftix/patching.scm b/loftix/patching.scm
index e665fb8..d638019 100644
--- a/loftix/patching.scm
+++ b/loftix/patching.scm
@@ -17,42 +17,40 @@
   #:use-module (guix packages))
 
 (define-public e9patch
-  (let ((commit "061f8dd6d48c3a6441d8300e697696bf415683a4")
-        (revision "0"))
-    (package
-      (name "e9patch")
-      (version (git-version "1.0.0-dev" revision commit))
-      (source (origin
-                (method git-fetch)
-                (uri (git-reference
-                     (url "https://github.com/GJDuck/e9patch")
-                     (commit commit)))
-                (sha256
-                 (base32
-                  "0l4bzkdfxhsdsjh2gk2pas4kkw8y5yrsl7hx1hlnhx2q0vp60kv6"))
-                (file-name (git-file-name name version))
-                (patches (search-patches
-                           ;; https://github.com/GJDuck/e9patch/pull/94
-                           "patches/e9patch-zydis-4.1.0.patch"
-                           ;; https://github.com/GJDuck/e9patch/pull/92
-                           "patches/e9patch-check.patch"
-                           ;; https://github.com/GJDuck/e9patch/pull/95
-                           "patches/e9patch-check-intel-format.patch"
-                           ;; https://github.com/GJDuck/e9patch/pull/93
-                           "patches/e9patch-check-mov-imm.patch"
-                           ;; https://github.com/GJDuck/e9patch/pull/97
-                           "patches/e9patch-check-same_op_2.patch"))))
-      (build-system gnu-build-system)
-      (arguments (list #:phases #~(modify-phases %standard-phases
-                                    (delete 'configure))
-                       #:make-flags #~(list (string-append
-                                              "PREFIX=" #$output))))
-      (native-inputs (list markdown xxd))
-      (inputs (list elfutils zycore zydis zlib))
-      (home-page "https://github.com/GJDuck/e9patch")
-      (synopsis "Static binary rewriting tool")
-      (description
-       "E9Patch is a static binary rewriting tool for x86-64 ELF binaries.
+  (package
+    (name "e9patch")
+    (version "1.0.0-rc10")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                   (url "https://github.com/GJDuck/e9patch")
+                   (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "1l2pjxgr2mckpffvj7hf0sjvv3678138afjb0wc3f6c2zrcpspf8"))
+              (file-name (git-file-name name version))
+              (patches (search-patches
+                         ;; https://github.com/GJDuck/e9patch/pull/94
+                         "patches/e9patch-zydis-4.1.0.patch"
+                         ;; https://github.com/GJDuck/e9patch/pull/92
+                         "patches/e9patch-check.patch"
+                         ;; https://github.com/GJDuck/e9patch/pull/95
+                         "patches/e9patch-check-intel-format.patch"
+                         ;; https://github.com/GJDuck/e9patch/pull/93
+                         "patches/e9patch-check-mov-imm.patch"
+                         ;; https://github.com/GJDuck/e9patch/pull/97
+                         "patches/e9patch-check-same_op_2.patch"))))
+    (build-system gnu-build-system)
+    (arguments (list #:phases #~(modify-phases %standard-phases
+                                  (delete 'configure))
+                     #:make-flags #~(list (string-append
+                                            "PREFIX=" #$output))))
+    (native-inputs (list markdown xxd))
+    (inputs (list elfutils zycore zydis zlib))
+    (home-page "https://github.com/GJDuck/e9patch")
+    (synopsis "Static binary rewriting tool")
+    (description
+     "E9Patch is a static binary rewriting tool for x86-64 ELF binaries.
 E9Patch is:
 @itemize
 @item Scalable: E9Patch can reliably rewrite large/complex binaries
@@ -64,5 +62,5 @@ E9Patch is:
 @item Programmable: E9Patch is designed so that it can be easily integrated
       into other projects.
 @end itemize")
-      (license (list license:expat ;src/e9patch/e9loader_*.cpp
-                     license:gpl3+))))) ;rest
+    (license (list license:expat ;src/e9patch/e9loader_*.cpp
+                   license:gpl3+)))) ;rest
diff --git a/loftix/transform.scm b/loftix/transform.scm
new file mode 100644
index 0000000..4edea16
--- /dev/null
+++ b/loftix/transform.scm
@@ -0,0 +1,44 @@
+;;; Package recipe transformations
+;;;
+;;; SPDX-FileCopyrightText: 2025 Nguyễn Gia Phong
+;;; SPDX-License-Identifier: GPL-3.0-or-later
+
+(define-module (loftix transform)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 receive)
+  #:use-module (srfi srfi-1)
+  #:export (append-env
+            append-make-flag))
+
+(define (append-env name addition default)
+  (setenv name
+          (let ((value (or (getenv name) default)))
+            (if value
+                (string-append value " " addition)
+                addition))))
+
+(define (append-make-flag original additions)
+  (let ((orig-ls (map (lambda (flag)
+                        (let ((ls (string-split flag #\=)))
+                          (list (car ls)
+                                (string-join (cdr ls)
+                                             "="))))
+                      original)))
+    (receive (existing new) (partition (lambda (addition)
+                                         (assoc (car addition)
+                                                orig-ls))
+                                       additions)
+      (append (map (match-lambda
+                     ((name value)
+                      (match (assoc name existing)
+                        ((or (addition)
+                             (addition default))
+                         (string-append name "=" value " " addition))
+                        (else (string-append name "=" value)))))
+                   orig-ls)
+              (map (match-lambda
+                     ((name addition)
+                      (string-append name "=" addition))
+                     ((name addition default)
+                      (string-append name "=" default " " addition)))
+                   new)))))
diff --git a/patches/afl++-keep-all-crashes.patch b/patches/afl++-keep-all-crashes.patch
index e3ce8f6..2b1f57d 100644
--- a/patches/afl++-keep-all-crashes.patch
+++ b/patches/afl++-keep-all-crashes.patch
@@ -1,16 +1,16 @@
 diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c
-index f05bb7db59d5..de275e374ff1 100644
+index 19cdf511149f..dd7cb510b62c 100644
 --- a/src/afl-fuzz-bitmap.c
 +++ b/src/afl-fuzz-bitmap.c
-@@ -556,7 +556,6 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault, u8 inc) {
-     if (likely(!new_bits && !new_paths)) {
+@@ -639,7 +639,6 @@ u8 __attribute__((hot)) save_if_interesting(afl_state_t *afl, void *mem,
+       if (san_fault == FSRV_RUN_OK) {
  
-       if (unlikely(afl->crash_mode)) { ++afl->total_crashes; }
--      return 0;
+         if (unlikely(afl->crash_mode)) { ++afl->total_crashes; }
+-        return 0;
  
-     }
+       } else {
  
-@@ -837,16 +836,12 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault, u8 inc) {
+@@ -934,8 +933,6 @@ may_save_fault:
  
        ++afl->total_crashes;
  
@@ -18,7 +18,8 @@ index f05bb7db59d5..de275e374ff1 100644
 -
        if (likely(!afl->non_instrumented_mode)) {
  
-         if (!classified) { classify_counts(&afl->fsrv); }
+         if (unlikely(!classified)) {
+@@ -947,8 +944,6 @@ may_save_fault:
  
          simplify_trace(afl, afl->fsrv.trace_bits);
  
diff --git a/patches/jasper-no-define-int-types.patch b/patches/jasper-no-define-int-types.patch
new file mode 100644
index 0000000..d6a5b0a
--- /dev/null
+++ b/patches/jasper-no-define-int-types.patch
@@ -0,0 +1,19 @@
+--- a/src/libjasper/include/jasper/jas_config.h.in
++++ b/src/libjasper/include/jasper/jas_config.h.in
+@@ -152,6 +152,7 @@
+ #undef inline
+ #endif
+ 
++#if 0
+ /* Define to `long long' if <sys/types.h> does not define. */
+ #undef longlong
+ 
+@@ -175,7 +176,7 @@
+ 
+ /* Define to `unsigned short' if <sys/types.h> does not define. */
+ #undef ushort
+-
++#endif
+ 
+ #else
+ /* A configure-based build is not being used. */