summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpi <pi@FreeBSD.org>2016-02-20 08:00:53 +0000
committerpi <pi@FreeBSD.org>2016-02-20 08:00:53 +0000
commit27e97cb1f60947918f820def3729c1ecd47c2d11 (patch)
treedea81bf575b0dc8e6b24e008661716750032b618
parent93edf0065d1e362d181a8a5a02b161e02778735f (diff)
downloadFreeBSD-ports-27e97cb1f60947918f820def3729c1ecd47c2d11.zip
FreeBSD-ports-27e97cb1f60947918f820def3729c1ecd47c2d11.tar.gz
security/afl: 1.96.b -> 2.02b
Changes: - Add new LLVM option which adds afl-clang-fast and afl-clang-fast++. Enabled by default, but broken on FreeBSD 9. - The PLOT_SUPPORT option was broken in r405132 because of a typo in its RUN_DEPENDS. Gnuplot is only required by afl-plot which will quit with an error alerting the user if it isn't installed, so instead of fixing the typo we remove it instead. Added a pkg-message suggesting to install gnuplot if afl-plot is wanted. PR: 207236 Submitted by: Tobias Kortkamp <t@tobik.me> (maintainer)
-rw-r--r--security/afl/Makefile64
-rw-r--r--security/afl/distinfo4
-rw-r--r--security/afl/files/patch-Makefile29
-rw-r--r--security/afl/files/patch-llvm__mode_afl-clang-fast.c15
-rw-r--r--security/afl/pkg-message1
-rw-r--r--security/afl/pkg-plist7
6 files changed, 94 insertions, 26 deletions
diff --git a/security/afl/Makefile b/security/afl/Makefile
index 6f77080..5fb6c2a 100644
--- a/security/afl/Makefile
+++ b/security/afl/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= afl
-PORTVERSION= 1.96b
+PORTVERSION= 2.02b
CATEGORIES= security
MASTER_SITES= http://lcamtuf.coredump.cx/afl/releases/
@@ -12,48 +12,66 @@ COMMENT= Fast instrumented fuzzer
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/docs/COPYING
-USES= compiler gmake tar:tgz
+USES= compiler gmake tar:tgz
-OPTIONS_DEFINE= DEBUG DOCS MINIMIZE_CORPUS PLOT_SUPPORT TEST_INSTRUMENTATION
+OPTIONS_DEFINE= DEBUG DOCS MINIMIZE_CORPUS LLVM TEST_INSTRUMENTATION
MINIMIZE_CORPUS_DESC= Install afl-cmin. Adds bash dependency
-PLOT_SUPPORT_DESC= Support progress plotting. Adds Gnuplot dependency
TEST_INSTRUMENTATION_DESC= Execute tests (expected to fail in jails)
-OPTIONS_DEFAULT= DOCS MINIMIZE_CORPUS PLOT_SUPPORT
+LLVM_DESC= LLVM-based instrumentation (broken on 9.x)
+OPTIONS_DEFAULT= DOCS LLVM MINIMIZE_CORPUS
OPTIONS_SUB= yes
-PORTSCOUT= ignore:1
-
-ONLY_FOR_ARCHS= amd64 i386
+ONLY_FOR_ARCHS= amd64 i386
ONLY_FOR_ARCHS_REASON= Uses binary instrumentation
-.include <bsd.port.pre.mk>
+LLVM_BUILD_DEPENDS= clang37:${PORTSDIR}/devel/llvm37
+LLVM_RUN_DEPENDS= clang37:${PORTSDIR}/devel/llvm37
+MINIMIZE_CORPUS_RUN_DEPENDS= ${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash
+
+.include <bsd.port.options.mk>
-.if (${COMPILER_TYPE} == "clang" && ${ARCH} == "i386")
+.if ${OSVERSION} < 1000013
+# Broken on FreeBSD 9
+PLIST_SUB+= LLVM_SUB="@comment "
+.else
+PLIST_SUB+= LLVM_SUB=""
+.endif
+
+.if ${ARCH} == "i386"
# Clang i386 emits .cfi_sections which base as(1) doesn't understand
-BUILD_DEPENDS += ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
-RUN_DEPENDS += ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
+BUILD_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
+RUN_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
.endif
-MINIMIZE_CORPUS_RUN_DEPENDS= ${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash
-PLOT_SUPORT_RUN_DEPENDS= gnuplot:${PORTSDIR}/math/gnuplot
+MAKE_ARGS= INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
+ INSTALL_SCRIPT="${INSTALL_SCRIPT}"
-post-patch:
-.if ! ${PORT_OPTIONS:MTEST_INSTRUMENTATION}
+post-patch-TEST_INSTRUMENTATION-off:
# afl needs shmget() which usually isn't available in jails. Disabling
# the instrumentation tests makes sure building packages in jails works
# by default anyway.
${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/Makefile
-.endif
- ${REINPLACE_CMD} -E -e 's@ -O3@@; s@ -g@@' \
- -e 's@install -m 755@${INSTALL_PROGRAM}@' \
- -e 's@ afl-(cmin|plot|whatsup) @ @g' \
- ${WRKSRC}/Makefile
-.if (${COMPILER_TYPE} == "clang" && ${ARCH} == "i386")
+ ${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/llvm_mode/Makefile
+
+post-patch:
+.if ${ARCH} == "i386"
${REINPLACE_CMD} -e 's@\( as_params\[0\] = afl_as ? afl_as : \)\(.*\)@\1(u8*)"${LOCALBASE}/bin/as";@' \
${WRKSRC}/afl-as.c
.endif
+.if ! ${OSVERSION} < 1000013
+# Broken on FreeBSD 9
+post-build-LLVM-on:
+ @(cd ${WRKSRC}/llvm_mode; ${SETENV} \
+ CC=clang37 \
+ CXX=clang++37 \
+ LLVM_CONFIG=llvm-config37 \
+ CFLAGS="${CFLAGS}" \
+ CXXFLAGS="${CXXFLAGS}" \
+ ${GMAKE})
+.endif
+
post-install:
${INSTALL_DATA} ${WRKSRC}/docs/COPYING ${STAGEDIR}${DOCSDIR}/
@@ -64,4 +82,4 @@ post-install:
post-install-MINIMIZE_CORPUS-on:
${INSTALL_SCRIPT} ${WRKSRC}/afl-cmin ${STAGEDIR}${PREFIX}/bin/
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/security/afl/distinfo b/security/afl/distinfo
index 2583594..b8cc69ef 100644
--- a/security/afl/distinfo
+++ b/security/afl/distinfo
@@ -1,2 +1,2 @@
-SHA256 (afl-1.96b.tgz) = 03beb06f8993dcb37d348e53da19ca9d064c83fcedc9d87b0b506c73c310f27c
-SIZE (afl-1.96b.tgz) = 804864
+SHA256 (afl-2.02b.tgz) = 8a508220675d3004ca6aef3cbf50dbbe4c377fc6723f3886ec36a8dfdc9bf057
+SIZE (afl-2.02b.tgz) = 809740
diff --git a/security/afl/files/patch-Makefile b/security/afl/files/patch-Makefile
new file mode 100644
index 0000000..fab7011
--- /dev/null
+++ b/security/afl/files/patch-Makefile
@@ -0,0 +1,29 @@
+--- Makefile.orig 2016-02-16 07:14:22 UTC
++++ Makefile
+@@ -21,6 +21,8 @@ BIN_PATH = $(PREFIX)/bin
+ HELPER_PATH = $(PREFIX)/lib/afl
+ DOC_PATH = $(PREFIX)/share/doc/afl
+ MISC_PATH = $(PREFIX)/share/afl
++INSTALL_PROGRAM?= install -s -m755
++INSTALL_SCRIPT?= isntall -m755
+
+ PROGS = afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze
+ SH_PROGS = afl-plot afl-cmin afl-whatsup
+@@ -115,12 +117,13 @@ clean:
+ install: all
+ mkdir -p -m 755 $${DESTDIR}$(BIN_PATH) $${DESTDIR}$(HELPER_PATH) $${DESTDIR}$(DOC_PATH) $${DESTDIR}$(MISC_PATH)
+ rm -f $${DESTDIR}$(BIN_PATH)/afl-plot.sh
+- install -m 755 $(PROGS) $(SH_PROGS) $${DESTDIR}$(BIN_PATH)
++ ${INSTALL_PROGRAM} $(PROGS) $${DESTDIR}$(BIN_PATH)
++ ${INSTALL_SCRIPT} $(SH_PROGS) $${DESTDIR}$(BIN_PATH)
+ rm -f $${DESTDIR}$(BIN_PATH)/afl-as
+- if [ -f afl-qemu-trace ]; then install -m 755 afl-qemu-trace $${DESTDIR}$(BIN_PATH); fi
+- if [ -f afl-clang-fast -a -f afl-llvm-pass.so -a -f afl-llvm-rt.o ]; then set -e; install -m 755 afl-clang-fast $${DESTDIR}$(BIN_PATH); ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang-fast++; install -m 755 afl-llvm-pass.so afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi
++ if [ -f afl-qemu-trace ]; then ${INSTALL_PROGRAM} afl-qemu-trace $${DESTDIR}$(BIN_PATH); fi
++ if [ -f afl-clang-fast -a -f afl-llvm-pass.so -a -f afl-llvm-rt.o ]; then set -e; ${INSTALL_PROGRAM} afl-clang-fast $${DESTDIR}$(BIN_PATH); ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang-fast++; ${INSTALL_PROGRAM} afl-llvm-pass.so $${DESTDIR}$(HELPER_PATH); install -m 755 afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi
+ set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $${DESTDIR}$(BIN_PATH)/$$i; done
+- install -m 755 afl-as $${DESTDIR}$(HELPER_PATH)
++ ${INSTALL_PROGRAM} afl-as $${DESTDIR}$(HELPER_PATH)
+ ln -sf afl-as $${DESTDIR}$(HELPER_PATH)/as
+ install -m 644 docs/README docs/ChangeLog docs/*.txt $${DESTDIR}$(DOC_PATH)
+ cp -r testcases/ $${DESTDIR}$(MISC_PATH)
diff --git a/security/afl/files/patch-llvm__mode_afl-clang-fast.c b/security/afl/files/patch-llvm__mode_afl-clang-fast.c
new file mode 100644
index 0000000..7720b6c
--- /dev/null
+++ b/security/afl/files/patch-llvm__mode_afl-clang-fast.c
@@ -0,0 +1,15 @@
+--- llvm_mode/afl-clang-fast.c.orig 2015-09-08 22:37:25 UTC
++++ llvm_mode/afl-clang-fast.c
+@@ -106,10 +106,10 @@ static void edit_params(u32 argc, char**
+
+ if (!strcmp(name, "afl-clang-fast++")) {
+ u8* alt_cxx = getenv("AFL_CXX");
+- cc_params[0] = alt_cxx ? alt_cxx : (u8*)"clang++";
++ cc_params[0] = alt_cxx ? alt_cxx : (u8*)"clang++37";
+ } else {
+ u8* alt_cc = getenv("AFL_CC");
+- cc_params[0] = alt_cc ? alt_cc : (u8*)"clang";
++ cc_params[0] = alt_cc ? alt_cc : (u8*)"clang37";
+ }
+
+ cc_params[cc_par_cnt++] = "-Xclang";
diff --git a/security/afl/pkg-message b/security/afl/pkg-message
new file mode 100644
index 0000000..951c996
--- /dev/null
+++ b/security/afl/pkg-message
@@ -0,0 +1 @@
+If you want to use afl-plot also install math/gnuplot.
diff --git a/security/afl/pkg-plist b/security/afl/pkg-plist
index 77fa564..65d3aad 100644
--- a/security/afl/pkg-plist
+++ b/security/afl/pkg-plist
@@ -1,11 +1,16 @@
+bin/afl-analyze
bin/afl-clang
bin/afl-clang++
+%%LLVM_SUB%%%%LLVM%%bin/afl-clang-fast
+%%LLVM_SUB%%%%LLVM%%bin/afl-clang-fast++
+%%LLVM_SUB%%%%LLVM%%lib/afl/afl-llvm-pass.so
+%%LLVM_SUB%%%%LLVM%%lib/afl/afl-llvm-rt.o
%%MINIMIZE_CORPUS%%bin/afl-cmin
bin/afl-fuzz
bin/afl-g++
bin/afl-gcc
bin/afl-gotcpu
-%%PLOT_SUPPORT%%bin/afl-plot
+bin/afl-plot
bin/afl-showmap
bin/afl-tmin
bin/afl-whatsup
OpenPOWER on IntegriCloud