From 31702b371998599c9a01d99e2f28073fa4ada223 Mon Sep 17 00:00:00 2001 From: Tobias Kortkamp Date: Tue, 25 Jun 2019 04:13:33 +0000 Subject: [PATCH] security/afl++: Unlock build on aarch64 In theory it might work on other archs but that has not been tested. While here - Install missing docs - Do not install afl-system-config since it is Linux only - Add CONFLICTS_INSTALL to security/afl (forgotten in r505008) --- security/afl++/Makefile | 21 ++++++++++++++++----- security/afl++/pkg-plist | 17 +++++++++-------- security/afl/Makefile | 2 ++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/security/afl++/Makefile b/security/afl++/Makefile index 8db52cde084f..23395c6fd34d 100644 --- a/security/afl++/Makefile +++ b/security/afl++/Makefile @@ -3,6 +3,7 @@ PORTNAME= afl PORTVERSION= 2.52c +PORTREVISION= 1 CATEGORIES= security PKGNAMESUFFIX= ++ @@ -12,10 +13,10 @@ COMMENT= Fast instrumented fuzzer LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/docs/COPYING -# In theory afl supports other architectures with the LLVM plugin. -# It has to be compiled with AFL_NO_X86=1 in that case. -ONLY_FOR_ARCHS= amd64 i386 -ONLY_FOR_ARCHS_REASON= Uses binary instrumentation +# In theory afl supports non-x86 architectures with the LLVM plugin. +# This has only been run tested on aarch64 so far. +ONLY_FOR_ARCHS= aarch64 amd64 i386 +ONLY_FOR_ARCHS_REASON= uses x86-only instrumentation or requires complete LLVM support USES= gmake tar:tgz USE_GITHUB= yes @@ -29,6 +30,8 @@ CONFLICTS_INSTALL= afl OPTIONS_DEFINE= DEBUG DOCS LLVM OPTIONS_DEFAULT= LLVM +# On non-x86 architectures LLVM is mandatory +OPTIONS_SLAVE= ${ARCH:Namd64:Ni386:S/${ARCH}/LLVM/} OPTIONS_SUB= yes LLVM_DESC= LLVM-based instrumentation @@ -43,6 +46,13 @@ LLVM_VARS= CC=clang${LLVM_DEFAULT} \ .include +.if ${ARCH} == "i386" || ${ARCH} == "amd64" +PLIST_SUB+= X86="" +.else +MAKE_ARGS+= AFL_NO_X86=1 +PLIST_SUB+= X86="@comment " +.endif + .if ${ARCH} == "i386" # Clang i386 emits .cfi_sections which base as(1) doesn't understand BUILD_DEPENDS+= ${LOCALBASE}/bin/as:devel/binutils @@ -83,7 +93,8 @@ post-install: post-install-LLVM-on: @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/afl/*.so \ ${STAGEDIR}${PREFIX}/bin/afl-clang-fast - ${INSTALL_DATA} ${WRKSRC}/llvm_mode/README.llvm \ + ${INSTALL_MAN} ${WRKSRC}/llvm_mode/README.laf-intel \ + ${WRKSRC}/llvm_mode/README.llvm \ ${STAGEDIR}${DOCSDIR} .include diff --git a/security/afl++/pkg-plist b/security/afl++/pkg-plist index 9c44c48f715c..83d9e3ec2029 100644 --- a/security/afl++/pkg-plist +++ b/security/afl++/pkg-plist @@ -1,24 +1,24 @@ bin/afl-analyze -bin/afl-clang -bin/afl-clang++ +%%X86%%bin/afl-clang +%%X86%%bin/afl-clang++ %%LLVM%%bin/afl-clang-fast %%LLVM%%bin/afl-clang-fast++ bin/afl-cmin bin/afl-fuzz -bin/afl-g++ -bin/afl-gcc +%%X86%%bin/afl-g++ +%%X86%%bin/afl-gcc bin/afl-gotcpu bin/afl-plot bin/afl-showmap -bin/afl-system-config +@comment bin/afl-system-config bin/afl-tmin bin/afl-whatsup -lib/afl/afl-as +%%X86%%lib/afl/afl-as %%LLVM%%lib/afl/afl-llvm-pass.so -%%LLVM%%lib/afl/afl-llvm-rt-32.o +%%X86%%%%LLVM%%lib/afl/afl-llvm-rt-32.o %%LLVM%%lib/afl/afl-llvm-rt-64.o %%LLVM%%lib/afl/afl-llvm-rt.o -lib/afl/as +%%X86%%lib/afl/as %%LLVM%%lib/afl/compare-transform-pass.so lib/afl/libdislocator.so %%LLVM%%lib/afl/split-compares-pass.so @@ -79,6 +79,7 @@ lib/afl/libdislocator.so %%PORTDOCS%%%%DOCSDIR%%/QuickStartGuide.txt %%PORTDOCS%%%%DOCSDIR%%/README %%PORTDOCS%%%%DOCSDIR%%/README.dislocator +%%LLVM%%%%PORTDOCS%%%%DOCSDIR%%/README.laf-intel %%LLVM%%%%PORTDOCS%%%%DOCSDIR%%/README.llvm %%PORTDOCS%%%%DOCSDIR%%/env_variables.txt %%PORTDOCS%%%%DOCSDIR%%/historical_notes.txt diff --git a/security/afl/Makefile b/security/afl/Makefile index 8836229abac0..ad09ae901509 100644 --- a/security/afl/Makefile +++ b/security/afl/Makefile @@ -24,6 +24,8 @@ USES= gmake tar:tgz ALL_TARGET= all libdislocator TEST_TARGET= test_build +CONFLICTS_INSTALL= afl++ + OPTIONS_DEFINE= DEBUG DOCS LLVM OPTIONS_DEFAULT= LLVM OPTIONS_SUB= yes