From: Duncaen <Duncaen@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: New package: afl++-4.07c
Date: Sun, 16 Jul 2023 16:57:34 +0200 [thread overview]
Message-ID: <20230716145734.bIXqiSjBkZnmTRQLL686bfyOJOB66aDAgwQr_EblVVs@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-44998@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 4741 bytes --]
New comment by Duncaen on void-packages repository
https://github.com/void-linux/void-packages/pull/44998#issuecomment-1637113701
Comment:
Here is the template I've had lying around, don't remember how finished it is, but I have x86_64-glibc version installed and used it a bit.
```diff
From 14518faadde08701569ed29142420bb6758ceb58 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Sun, 16 Jul 2023 16:55:27 +0200
Subject: [PATCH] New package: afl++-4.06c
---
.../0001-fix-missing-max-path-define.patch | 20 +++++++
.../0003-fix-wrong-format-specifier.patch | 15 +++++
srcpkgs/afl++/template | 58 +++++++++++++++++++
3 files changed, 93 insertions(+)
create mode 100644 srcpkgs/afl++/patches/0001-fix-missing-max-path-define.patch
create mode 100644 srcpkgs/afl++/patches/0003-fix-wrong-format-specifier.patch
create mode 100644 srcpkgs/afl++/template
diff --git a/srcpkgs/afl++/patches/0001-fix-missing-max-path-define.patch b/srcpkgs/afl++/patches/0001-fix-missing-max-path-define.patch
new file mode 100644
index 0000000000..8711c06961
--- /dev/null
+++ b/srcpkgs/afl++/patches/0001-fix-missing-max-path-define.patch
@@ -0,0 +1,20 @@
+Source: https://git.alpinelinux.org/aports/tree/community/afl++/0001-fix-missing-max-path-define.patch
+Fix for:
+
+ src/afl-ld-lto.c:260:15: error: use of undeclared identifier 'PATH_MAX'
+ char thecwd[PATH_MAX];
+
+--- AFLplusplus-4.00c/src/afl-ld-lto.c
++++ AFLplusplus-4.00c/src/afl-ld-lto.c
+@@ -45,10 +45,7 @@
+
+ #include <dirent.h>
+
+-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
+- defined(__DragonFly__)
+- #include <limits.h>
+-#endif
++#include <limits.h>
+
+ #ifdef __APPLE__
+ #include <sys/syslimits.h>
diff --git a/srcpkgs/afl++/patches/0003-fix-wrong-format-specifier.patch b/srcpkgs/afl++/patches/0003-fix-wrong-format-specifier.patch
new file mode 100644
index 0000000000..49622819a7
--- /dev/null
+++ b/srcpkgs/afl++/patches/0003-fix-wrong-format-specifier.patch
@@ -0,0 +1,15 @@
+Source: https://git.alpinelinux.org/aports/tree/community/afl++/0003-fix-wrong-format-specifier.patch
+The format specifier for size_t is %zu and not %lu. Fixing this to
+prevent issues on 32 bit machines.
+
+--- AFLplusplus-4.00c/instrumentation/SanitizerCoverageLTO.so.cc
++++ AFLplusplus-4.00c/instrumentation/SanitizerCoverageLTO.so.cc
+@@ -1080,7 +1080,7 @@
+ }
+
+ if (!be_quiet)
+- printf("AUTODICTIONARY: %lu string%s found\n", count,
++ printf("AUTODICTIONARY: %zu string%s found\n", count,
+ count == 1 ? "" : "s");
+
+ if (count) {
diff --git a/srcpkgs/afl++/template b/srcpkgs/afl++/template
new file mode 100644
index 0000000000..c16d74c6eb
--- /dev/null
+++ b/srcpkgs/afl++/template
@@ -0,0 +1,58 @@
+# Template file for 'afl++'
+pkgname=afl++
+version=4.06c
+revision=1
+#wrksrc=
+#create_wrksrc=yes
+#only_for_archs="i686 x86_64"
+build_style=gnu-makefile
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="clang llvm lld "
+makedepends="gmp-devel "
+depends=""
+short_desc="AFL fork fuzzer relying on genetic algorithms instead of brute force"
+maintainer="Duncaen <duncaen@voidlinux.org>"
+license="Apache-2.0"
+homepage="https://aflplus.plus/"
+distfiles="https://github.com/AFLplusplus/AFLplusplus/archive/refs/tags/${version}.tar.gz"
+checksum=98ef9d9a1eee10b1642067700a3ea2ff87ee7aa6ca4a15cb924053c41d119423
+
+ignore_elf_dirs="/usr/share/afl/testcases/others/elf"
+nostrip_files="small_archive.a small_exec.elf"
+conflicts="afl>=0"
+
+post_patch() {
+ vsed -e 's/install: all/install:/' -i GNUmakefile
+ vsed -e '/-f GNUmakefile.llvm$/d' -i GNUmakefile
+}
+
+do_build() {
+ case "${XBPS_TARGET_MACHINE}" in
+ x86_64*|i686*) ;;
+ *) export AFL_NO_X86=1 ;;
+ esac
+ if [[ -v CROSS_BUILD ]]; then
+ CLANG_TARGET="-target=${XBPS_CROSS_TRIPLET}"
+ fi
+ echo $LDFLAGS
+ export CFLAGS="${CFLAGS//-fstack-clash-protection}"
+ export CFLAGS="${CFLAGS//-D_FORTIFY_SOURCE=2}"
+ export CXXFLAGS="${CXXFLAGS//-fstack-clash-protection}"
+ export CXXFLAGS="${CXXFLAGS//-D_FORTIFY_SOURCE=2}"
+ make PREFIX=/usr CLANG_BIN="$CLANG_BIN" CLANGPP_BIN="$CLANGPP_BIN" all
+ make -f GNUmakefile.llvm PREFIX=/usr CFLAGS="${CLANG_TARGET} ${CFLAGS}" CXXFLAGS="${CLANG_TARGET} ${CXXFLAGS}"
+}
+
+pre_install() {
+ export AFL_NO_X86=1
+}
+
+post_install() {
+ # Test cases contain binary .../testcases/others/elf/small_exec.elf
+ # so move them to /usr/lib/afl
+ mv ${DESTDIR}/usr/{share,lib}/afl/testcases
+}
--
2.41.0
```
next prev parent reply other threads:[~2023-07-16 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 18:18 [PR PATCH] " leahneukirchen
2023-07-16 14:57 ` Duncaen [this message]
2023-07-16 14:59 ` Duncaen
2023-08-05 13:53 ` [PR PATCH] [Updated] " leahneukirchen
2023-08-05 14:48 ` leahneukirchen
2023-08-05 16:23 ` [PR PATCH] [Merged]: " leahneukirchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230716145734.bIXqiSjBkZnmTRQLL686bfyOJOB66aDAgwQr_EblVVs@z \
--to=duncaen@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).