Index: head/security/afl/Makefile =================================================================== --- head/security/afl/Makefile +++ head/security/afl/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= afl -PORTVERSION= 2.36 +PORTVERSION= 2.39 DISTVERSIONSUFFIX= b CATEGORIES= security MASTER_SITES= http://lcamtuf.coredump.cx/afl/releases/ @@ -13,24 +13,25 @@ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/docs/COPYING -USES= compiler gmake tar:tgz - -OPTIONS_DEFINE= DEBUG DOCS MINIMIZE_CORPUS LLVM TEST_INSTRUMENTATION -MINIMIZE_CORPUS_DESC= Install afl-cmin. Adds bash dependency -TEST_INSTRUMENTATION_DESC= Execute tests (expected to fail in jails) -LLVM_DESC= LLVM-based instrumentation (broken on 9.x) -OPTIONS_DEFAULT= LLVM MINIMIZE_CORPUS - -OPTIONS_SUB= yes - +# 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 -LLVM_VERSION= 38 +USES= gmake tar:tgz + +TEST_TARGET= test_build +OPTIONS_DEFINE= DEBUG DOCS LLVM +OPTIONS_DEFAULT= LLVM +OPTIONS_SUB= yes + +LLVM_DESC= LLVM-based instrumentation +LLVM_VERSION= 39 LLVM_BUILD_DEPENDS= clang${LLVM_VERSION}:devel/llvm${LLVM_VERSION} LLVM_RUN_DEPENDS= clang${LLVM_VERSION}:devel/llvm${LLVM_VERSION} -MINIMIZE_CORPUS_RUN_DEPENDS= ${LOCALBASE}/bin/bash:shells/bash +LLVM_VARS= CC=clang${LLVM_VERSION} CXX=clang++${LLVM_VERSION} \ + MAKE_ARGS=LLVM_CONFIG=llvm-config${LLVM_VERSION} .include @@ -40,44 +41,40 @@ RUN_DEPENDS+= ${LOCALBASE}/bin/as:devel/binutils .endif -MAKE_ARGS= INSTALL_PROGRAM="${INSTALL_PROGRAM}" \ - INSTALL_SCRIPT="${INSTALL_SCRIPT}" - -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 - ${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/llvm_mode/Makefile - post-patch: +# Disable the instrumentation tests to make sure building packages in +# jails works by default. afl needs shmget() which usually isn't +# available in jails. + @${REINPLACE_CMD} 's@^\(all.*\) test_build@\1@' \ + ${WRKSRC}/Makefile ${WRKSRC}/llvm_mode/Makefile .if ${ARCH} == "i386" - ${REINPLACE_CMD} -e 's@\( as_params\[0\] = afl_as ? afl_as : \)\(.*\)@\1(u8*)"${LOCALBASE}/bin/as";@' \ + @${REINPLACE_CMD} 's@\( as_params\[0\] = afl_as ? afl_as : \)\(.*\)@\1(u8*)"${LOCALBASE}/bin/as";@' \ ${WRKSRC}/afl-as.c .endif post-patch-LLVM-on: - ${REINPLACE_CMD} \ + @${REINPLACE_CMD} \ -e 's|"clang"|"clang${LLVM_VERSION}"|g' \ -e 's|"clang\+\+"|"clang\+\+${LLVM_VERSION}"|g' \ ${WRKSRC}/llvm_mode/afl-clang-fast.c post-build-LLVM-on: - @(cd ${WRKSRC}/llvm_mode; ${SETENV} \ - CC=clang${LLVM_VERSION} \ - CXX=clang++${LLVM_VERSION} \ - LLVM_CONFIG=llvm-config${LLVM_VERSION} \ - CFLAGS="${CFLAGS}" \ - CXXFLAGS="${CXXFLAGS}" \ - ${GMAKE}) + @(cd ${WRKSRC}/llvm_mode; ${DO_MAKE_BUILD} ${ALL_TARGET}) + +post-test-LLVM-on: + @(cd ${WRKSRC}/llvm_mode; ${DO_MAKE_BUILD} ${TEST_TARGET}) post-install: - ${INSTALL_DATA} ${WRKSRC}/docs/COPYING ${STAGEDIR}${DOCSDIR}/ -.for afl_script in afl-cmin afl-plot afl-whatsup - ${INSTALL_SCRIPT} ${WRKSRC}/${afl_script} ${STAGEDIR}${PREFIX}/bin/ +.for script in afl-cmin afl-plot afl-whatsup + ${INSTALL_SCRIPT} ${WRKSRC}/${script} ${STAGEDIR}${PREFIX}/bin +.endfor + @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/afl/afl-as +.for prog in afl-analyze afl-fuzz afl-gcc afl-gotcpu afl-showmap afl-tmin + @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${prog} .endfor -post-install-MINIMIZE_CORPUS-on: - ${INSTALL_SCRIPT} ${WRKSRC}/afl-cmin ${STAGEDIR}${PREFIX}/bin/ +post-install-LLVM-on: + @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/afl/afl-llvm-pass.so + @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/afl-clang-fast .include Index: head/security/afl/distinfo =================================================================== --- head/security/afl/distinfo +++ head/security/afl/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1484928306 -SHA256 (afl-2.36b.tgz) = d36e2643eaddbd6e79a0dd835fd6e23428198a7a7cd640e96ccbf21d5bd8bcc8 -SIZE (afl-2.36b.tgz) = 830689 +TIMESTAMP = 1487164780 +SHA256 (afl-2.39b.tgz) = 968eceae4d013eee62bc8f2fdddbb7060b92e03a0175153b0285ec7f5c78f141 +SIZE (afl-2.39b.tgz) = 830897 Index: head/security/afl/files/patch-Makefile =================================================================== --- head/security/afl/files/patch-Makefile +++ head/security/afl/files/patch-Makefile @@ -1,31 +0,0 @@ ---- Makefile.orig 2016-08-07 07:03:02 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?= install -m755 - - # PROGS intentionally omit afl-as, which gets installed elsewhere. - -@@ -120,14 +122,15 @@ 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 afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi - if [ -f afl-llvm-rt-32.o ]; then set -e; install -m 755 afl-llvm-rt-32.o $${DESTDIR}$(HELPER_PATH); fi - if [ -f afl-llvm-rt-64.o ]; then set -e; install -m 755 afl-llvm-rt-64.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) Index: head/security/afl/pkg-message =================================================================== --- head/security/afl/pkg-message +++ head/security/afl/pkg-message @@ -1 +0,0 @@ -To use afl-plot you also need to install math/gnuplot Index: head/security/afl/pkg-plist =================================================================== --- head/security/afl/pkg-plist +++ head/security/afl/pkg-plist @@ -7,7 +7,7 @@ %%LLVM%%lib/afl/afl-llvm-rt.o %%LLVM%%lib/afl/afl-llvm-rt-32.o %%LLVM%%lib/afl/afl-llvm-rt-64.o -%%MINIMIZE_CORPUS%%bin/afl-cmin +bin/afl-cmin bin/afl-fuzz bin/afl-g++ bin/afl-gcc @@ -69,7 +69,6 @@ %%DATADIR%%/others/sql/simple_queries.sql %%DATADIR%%/others/text/hello_world.txt %%DATADIR%%/others/xml/small_document.xml -%%PORTDOCS%%%%DOCSDIR%%/COPYING %%PORTDOCS%%%%DOCSDIR%%/ChangeLog %%PORTDOCS%%%%DOCSDIR%%/README %%PORTDOCS%%%%DOCSDIR%%/env_variables.txt