Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2014 16:02:24 +0100
From:      Jan Beich <jbeich@vfemail.net>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Request for (i386) testing: american fuzzy lop
Message-ID:  <fvdc-7g1r-wny@vfemail.net>
In-Reply-To: <1557502e.1751489a@fabiankeil.de> (Fabian Keil's message of "Fri,  21 Nov 2014 11:51:08 %2B0100")
References:  <3dc1c153.7b7b9177@fabiankeil.de> <546DF8A5.3060601@gmail.com> <3fb914c3.1002708a@fabiankeil.de> <a93l-6cj5-wny@vfemail.net> <1557502e.1751489a@fabiankeil.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Fabian Keil <freebsd-listen@fabiankeil.de> writes:

>>   [*] Testing the CC wrapper and instrumentation output...
>>   AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./afl-clang -O2 -pipe
>> -fstack-protector -fno-strict-aliasing -Wall -D_FORTIFY_SOURCE=2
>> -Wno-pointer-sign -DAFL_PATH=\"/prefix/afl-0.60b/lib/afl\"
>> -DDOC_PATH=\"/prefix/afl-0.60b/share/doc/afl\" -DVERSION=\"0.60b\"
>> -Wno-format test-instr.c -o test-instr
>>   /tmp/.afl-19244-1416499444.s: Assembler messages:
>>   /tmp/.afl-19244-1416499444.s:222: Error: unknown pseudo-op: `.cfi_sections'
>>   clang: error: assembler command failed with exit code 1 (use -v to
>> see invocation)
>
> I updated the port to (hopefully) use as from ports on i386:
> http://www.fabiankeil.de/sourcecode/freebsd/afl-61b.shar
>
> Does this make a difference?

Maybe, if you want to force devel/binutils on 9.x users. It'd be nice to
debug why clang misbehaves. Anyway, this version has wrong checksum.

  => afl-0.61b.tgz doesn't seem to exist in /portdistfiles/.
  => Attempting to fetch http://lcamtuf.coredump.cx/afl/releases/afl-0.61b.tgz
  fetch: http://lcamtuf.coredump.cx/afl/releases/afl-0.61b.tgz: size mismatch: expected 678088, actual 678234

After fixing I've tested on 11.0C i386, 10.1R i386, 10.0R amd64, 9.3R i386,
9.1R i386, 8.4R amd64 + tainted host on 11.0C amd64. For one, 8.x exhibit 
another old GNU as(1) issue:

  [*] Testing the CC wrapper and instrumentation output...
  AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc -O2 -pipe -fstack-protector -fno-strict-aliasing -Wall -D_FORTIFY_SOURCE=2 -Wno-pointer-sign -DAFL_PATH=\"/prefix/afl-0.61b/lib/afl\" -DDOC_PATH=\"/prefix/afl-0.61b/share/doc/afl\" -DVERSION=\"0.61b\" -Wno-format test-instr.c -o test-instr
  /tmp/.afl-16870-1416574405.s: Assembler messages:
  /tmp/.afl-16870-1416574405.s:572: Error: suffix or operands invalid for `lahf'
  /tmp/.afl-16870-1416574405.s:593: Error: suffix or operands invalid for `sahf'
  Makefile:65: recipe for target 'test_build' failed

> +.if ${ARCH} == "i386"
> +BUILD_DEPENDS +=	${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
> +.endif
[...]
> +.if ${ARCH} == "i386"
> +	${REINPLACE_CMD} -e 's@\(  as_params\[0\] = "\)@\1${LOCALBASE}/bin/@' \
> +		${WRKSRC}/afl-as.c
> +.endif

If ${LOCALBASE}/bin/as maybe called after install then you have to
adjust RUN_DEPENDS. Keep in mind package-only users.

>
> If not, I'll probably just submit the port marked as broken
> for i386 and try to get this working later on.
>
> Fabian

A passing by committer may also complain about PORTVERSION vs. DISTVERSION,
lack of LICENSE and DATADIR in pkg-plist.

diff --git security/afl/Makefile security/afl/Makefile
index e197507..db31853 100644
--- security/afl/Makefile
+++ security/afl/Makefile
@@ -9,7 +9,7 @@ MASTER_SITES=	http://lcamtuf.coredump.cx/afl/releases/
 MAINTAINER=	fk@fabiankeil.de
 COMMENT=	Fast instrumented fuzzer
 
-USES=		gmake tar:tgz
+USES=		compiler gmake tar:tgz
 
 OPTIONS_DEFINE=			DEBUG DOCS TEST_INSTRUMENTATION
 TEST_INSTRUMENTATION_DESC=	Execute tests expected to fail in jails
@@ -18,10 +18,14 @@ OPTIONS_DEFAULT=		DOCS
 ONLY_FOR_ARCHS=		amd64 i386
 ONLY_FOR_ARCHS_REASON=	Uses binary instrumentation
 
-.include <bsd.port.options.mk>
+# XXX replace with bsd.port.options.mk once 8.4-RELEASE is EOL
+# COMPILER_TYPE is defined in .pre without /usr/share/mk/bsd.compiler.mk
+.include <bsd.port.pre.mk>
 
-.if ${ARCH} == "i386"
+.if (${COMPILER_TYPE} == "clang" && ${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
 .endif
 
 post-patch:
@@ -32,16 +36,21 @@ post-patch:
 	${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/Makefile
 .endif
 	${REINPLACE_CMD} -e 's@ -O3@@; s@ -g@@' \
-		-e 's/install -m 755/${INSTALL_PROGRAM}/' \
+		-e 's@install -m 755@${INSTALL_PROGRAM}@' \
 		${WRKSRC}/Makefile
-.if ${ARCH} == "i386"
+.if (${COMPILER_TYPE} == "clang" && ${ARCH} == "i386")
 	${REINPLACE_CMD} -e 's@\(  as_params\[0\] = "\)@\1${LOCALBASE}/bin/@' \
 		${WRKSRC}/afl-as.c
 .endif
+# XXX remove once 8.4-RELEASE is EOL
+# GNU as 2.15 doesn't understand lahf/sahf on amd64
+	${REINPLACE_CMD} -e 's@ifdef.*\(__OpenBSD__\)@if defined(\1) || \
+		(defined(__FreeBSD__) \&\& __FreeBSD__ < 9)@' \
+		${WRKSRC}/afl-as.h
 
 post-install:
 .if ${PORT_OPTIONS:MDOCS}
 	${INSTALL_DATA} ${WRKSRC}/docs/COPYING ${STAGEDIR}${DOCSDIR}/
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git security/afl/distinfo security/afl/distinfo
index 4b1882f..1b796a9 100644
--- security/afl/distinfo
+++ security/afl/distinfo
@@ -1,2 +1,2 @@
-SHA256 (afl-0.61b.tgz) = edff2e8f2c37041bdbb225ee7095587c1a744a3bc44f1e52491904ae986b4f9f
-SIZE (afl-0.61b.tgz) = 678088
+SHA256 (afl-0.61b.tgz) = 6f0613c4568bb24f43c8672c351a7205c41836f0d6def9ce98b75aca119d3a1e
+SIZE (afl-0.61b.tgz) = 678234

-------------------------------------------------

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fvdc-7g1r-wny>