diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2025-10-05 23:55:37 +0900 |
|---|---|---|
| committer | 宋文武 <iyzsong@member.fsf.org> | 2025-11-22 13:38:41 +0800 |
| commit | b9e5d234d9551dfb85f1c2c6f400b6ae93ddb559 (patch) | |
| tree | a1d97649068a694eb7d31aa16a87749c2676a8b1 /gnu/packages/debug.scm | |
| parent | b54a32731a28b505b4bf6c9533c67827e54da205 (diff) | |
gnu: Add qemu-for-aflplusplus.
* gnu/packages/debug.scm (qemu-for-aflplusplus): New variable.
Change-Id: Iecb693c5f4544ac511387a59819ecab422c62949
Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
Diffstat (limited to 'gnu/packages/debug.scm')
| -rw-r--r-- | gnu/packages/debug.scm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm index f36fb9d2eb0..6869436deb3 100644 --- a/gnu/packages/debug.scm +++ b/gnu/packages/debug.scm | |||
| @@ -529,6 +529,83 @@ server and embedded PowerPC, and S390 guests.") | |||
| 529 | ;; Several tests fail on MIPS. | 529 | ;; Several tests fail on MIPS. |
| 530 | (supported-systems (delete "mips64el-linux" %supported-systems)))))) | 530 | (supported-systems (delete "mips64el-linux" %supported-systems)))))) |
| 531 | 531 | ||
| 532 | (define-public qemu-for-aflplusplus | ||
| 533 | (let ((base qemu-minimal) | ||
| 534 | (commit "790d2124fd054621d3c0d3ec31bea114b60601f9") | ||
| 535 | (revision "0")) | ||
| 536 | (hidden-package | ||
| 537 | (package | ||
| 538 | (inherit base) | ||
| 539 | (name "qemu") | ||
| 540 | (version (git-version "5.2.50" revision commit)) | ||
| 541 | (source | ||
| 542 | (origin | ||
| 543 | (method git-fetch) | ||
| 544 | (uri (git-reference (url "https://github.com/AFLplusplus/qemuafl") | ||
| 545 | (commit commit) | ||
| 546 | (recursive? #t))) | ||
| 547 | (file-name (git-file-name name version)) | ||
| 548 | (sha256 | ||
| 549 | (base32 "1l2kl8768l4mbkiaj63zn6gsdn3qpl3rg7s6h62rmd7599ar3xn3")))) | ||
| 550 | (arguments | ||
| 551 | (substitute-keyword-arguments (package-arguments base) | ||
| 552 | ((#:configure-flags _ #~'()) | ||
| 553 | #~(list (string-append | ||
| 554 | "--target-list=" | ||
| 555 | ;; AFL++ only supports using a single afl-qemu-trace, | ||
| 556 | ;; so we only build qemu for the native target. | ||
| 557 | (match #$(let-system system system) | ||
| 558 | ("aarch64-linux" "aarch64-linux-user") | ||
| 559 | ("armhf-linux" "arm-linux-user") | ||
| 560 | ("i686-linux" "i386-linux-user") | ||
| 561 | ("mips64el-linux" "mips64el-linux-user") | ||
| 562 | ("powerpc-linux" "ppc-linux-user") | ||
| 563 | ("riscv64-linux" "riscv64-linux-user") | ||
| 564 | ("x86_64-linux" "x86_64-linux-user"))))) | ||
| 565 | ((#:phases phases) | ||
| 566 | #~(modify-phases #$phases | ||
| 567 | (delete 'replace-firmwares) | ||
| 568 | (delete 'patch-embedded-shebangs) | ||
| 569 | (delete 'fix-optionrom-makefile) | ||
| 570 | (delete 'disable-unusable-tests) | ||
| 571 | (replace 'configure | ||
| 572 | (lambda* (#:key configure-flags #:allow-other-keys) | ||
| 573 | ;; The `configure' script doesn't understand some of the | ||
| 574 | ;; GNU options. Thus, add a new phase that's compatible. | ||
| 575 | (setenv "SHELL" (which "bash")) | ||
| 576 | ;; The binaries need to be linked against -lrt. | ||
| 577 | (setenv "LDFLAGS" "-lrt") | ||
| 578 | (apply invoke | ||
| 579 | "./configure" | ||
| 580 | (string-append "--cc=" #$(cc-for-target)) | ||
| 581 | ;; Some architectures insist on using HOST_CC | ||
| 582 | (string-append "--host-cc=" #$(cc-for-target)) | ||
| 583 | "--disable-debug-info" ; save build space | ||
| 584 | (string-append "--prefix=" #$output) | ||
| 585 | (string-append "--sysconfdir=/etc") | ||
| 586 | configure-flags))) | ||
| 587 | (add-after 'install 'install-qasan-header | ||
| 588 | (lambda _ | ||
| 589 | (install-file "qemuafl/qasan.h" | ||
| 590 | (string-append #$output "/include")))) | ||
| 591 | (delete 'delete-firmwares) | ||
| 592 | #$@(if (target-riscv64?) | ||
| 593 | '((replace 'disable-some-tests | ||
| 594 | (lambda _ | ||
| 595 | ;; qemu.qmp.QMPConnectError: | ||
| 596 | ;; Unexpected empty reply from server | ||
| 597 | (delete-file "tests/qemu-iotests/040") | ||
| 598 | (delete-file "tests/qemu-iotests/041") | ||
| 599 | (delete-file "tests/qemu-iotests/256") | ||
| 600 | ;; No 'PCI' bus found for device 'virtio-scsi-pci' | ||
| 601 | (delete-file "tests/qemu-iotests/127") | ||
| 602 | (delete-file "tests/qemu-iotests/267")))) | ||
| 603 | '()))))) | ||
| 604 | (inputs (modify-inputs (package-inputs base) | ||
| 605 | (delete "dtc"))) | ||
| 606 | (home-page "https://github.com/AFLplusplus/qemuafl") | ||
| 607 | (synopsis "QEMU for AFL++"))))) | ||
| 608 | |||
| 532 | (define-public aflplusplus | 609 | (define-public aflplusplus |
| 533 | (package | 610 | (package |
| 534 | (inherit american-fuzzy-lop) | 611 | (inherit american-fuzzy-lop) |
