security/afl++: Unbreak the build on FreeBSD 14.x

After the update to 4.33c (271077d852) it failed due to
missing includes. Add a patch to add the includes.
Upstreamed in: https://github.com/AFLplusplus/AFLplusplus/pull/2509

Add another patch to skip testing if AFL_NO_TEST_BUILD is set.
Upstreamed in: https://github.com/AFLplusplus/AFLplusplus/pull/2510

Unconditionally set AFL_NO_X86=1 and set AFL_NO_TEST_BUILD=1
to allow building proper packages in jails with default settings.
Previously the packages were incomplete:

     fk@test-vm ~/git/privoxy $/usr/local/afl++-llvm/bin/afl-cc --version

     [-] PROGRAM ABORT : Unable to find 'afl-compiler-rt.o'. Please set the AFL_PATH environment variable.
              Location : find_built_deps(), src/afl-cc.c:594

While at it:

- Take over maintainership.
- Add afl-cmin.py to the SHEBANG_FILES.
- Mark BROKEN on FreeBSD 13.x for now.

PR:		288674
Approved by:	db@ (Mentor) or yuri@ (Mentor)
This commit is contained in:
Fabian Keil
2025-06-29 12:16:15 +02:00
committed by Älven
parent f58404584c
commit d6126c8f34
3 changed files with 35 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ DISTVERSION= 4.33c
CATEGORIES= security
PKGNAMESUFFIX= ++-${FLAVOR}
MAINTAINER= ports@FreeBSD.org
MAINTAINER= fk@fabiankeil.de
COMMENT= Fast instrumented fuzzer
WWW= https://aflplus.plus/
@@ -13,6 +13,7 @@ LICENSE_FILE= ${WRKSRC}/docs/COPYING
ONLY_FOR_ARCHS= aarch64 amd64 i386 powerpc powerpc64 powerpc64le riscv64
ONLY_FOR_ARCHS_REASON= uses x86-only instrumentation or requires complete LLVM support
BROKEN_FreeBSD_13= fails to build, error: unknown type name 'mode_t'
BUILD_DEPENDS= ginstall:sysutils/coreutils
@@ -30,10 +31,10 @@ USE_GCC= yes
USE_GITHUB= yes
GH_ACCOUNT= AFLplusplus
GH_PROJECT= AFLplusplus
SHEBANG_FILES= afl-persistent-config
SHEBANG_FILES= afl-cmin.py afl-persistent-config
MAKEFILE= GNUmakefile
MAKE_ARGS= ${${ARCH} != amd64 && ${ARCH} != i386:?AFL_NO_X86=1:} \
MAKE_ARGS= AFL_NO_X86=1 AFL_NO_TEST_BUILD=1 \
PREFIX="${PREFIX}/${PKGBASE}"
.if ${FLAVOR} == llvm
CFLAGS_riscv64= -mno-relax

View File

@@ -0,0 +1,20 @@
--- GNUmakefile.llvm.orig 2025-06-28 20:29:37 UTC
+++ GNUmakefile.llvm
@@ -554,6 +554,9 @@ test_build: $(PROGS)
.PHONY: test_build
test_build: $(PROGS)
+ifdef AFL_NO_TEST_BUILD
+ @echo "[*] Not testing the CC wrapper and instrumentation output (AFL_NO_TEST_BUILD set)."
+else
@echo "[*] Testing the CC wrapper and instrumentation output..."
unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO AFL_LLVM_ALLOWLIST AFL_LLVM_DENYLIST; ASAN_OPTIONS=detect_leaks=0 AFL_QUIET=1 AFL_PATH=. AFL_LLVM_LAF_ALL=1 ./afl-cc $(CFLAGS) $(CPPFLAGS) ./test-instr.c -o test-instr $(LDFLAGS)
ifdef IS_IOS
@@ -564,6 +567,7 @@ endif
@rm -f test-instr
@cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please post to https://github.com/AFLplusplus/AFLplusplus/issues to troubleshoot the issue."; echo; exit 1; fi
@echo "[+] All right, the instrumentation seems to be working!"
+endif
.PHONY: all_done
all_done: test_build

View File

@@ -0,0 +1,11 @@
--- include/forkserver.h.orig 2025-06-28 20:29:37 UTC
+++ include/forkserver.h
@@ -30,6 +30,8 @@
#include <stdio.h>
#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
#include "types.h"