diff options
| author | Nguyễn Gia Phong <cnx@loang.net> | 2025-05-20 23:12:14 +0900 |
|---|---|---|
| committer | Nguyễn Gia Phong <cnx@loang.net> | 2025-05-20 23:12:14 +0900 |
| commit | 01b7ce85ed8a861aabca4b548da43e2ddcec61c1 (patch) | |
| tree | e7b92073ab82c693e698531edb5a908daf41a696 | |
| parent | 7c1a28e2fa7aca5db886ffa9b88f9a053d2c92a6 (diff) | |
| download | loftix-01b7ce85ed8a861aabca4b548da43e2ddcec61c1.tar.gz | |
Fix QEMU for AFL++
| -rw-r--r-- | loftix/emulation.scm | 5 | ||||
| -rw-r--r-- | loftix/fuzzing.scm | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/loftix/emulation.scm b/loftix/emulation.scm index 0f7cbe2..a0d4a9c 100644 --- a/loftix/emulation.scm +++ b/loftix/emulation.scm @@ -78,6 +78,11 @@ ,(string-append "--prefix=" out) ,(string-append "--sysconfdir=/etc") ,@configure-flags))))) + (add-after 'install 'install-qasan-header + (lambda* (#:key outputs #:allow-other-keys) + (install-file "qemuafl/qasan.h" + (string-append (assoc-ref outputs "out") + "/include")))) (delete 'delete-firmwares))))))))) (define-public qemu-for-fuzzolic diff --git a/loftix/fuzzing.scm b/loftix/fuzzing.scm index c715bbc..de1ac77 100644 --- a/loftix/fuzzing.scm +++ b/loftix/fuzzing.scm @@ -33,6 +33,23 @@ (package (inherit aflplusplus) (name "afl++") + (arguments + (substitute-keyword-arguments (package-arguments aflplusplus) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'build 'build-qasan + (lambda* (#:key make-flags #:allow-other-keys) + (apply invoke + "make" "-C" "qemu_mode/libqasan" + make-flags))) + ;; afl-qemu-trace is a symbolic link to QEMU's binary. + ;; Substituting its source code with AFL++'s output path + ;; would result in a dependency cycle. + (add-after 'install-qemu 'wrap-qemu + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (wrap-program (string-append out "/bin/afl-qemu-trace") + `("AFL_PATH" = (,(string-append out "/lib/afl"))))))))))) (inputs (modify-inputs (package-inputs aflplusplus) (replace "qemu" qemu-for-aflplusplus))))) |
