From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/
Date: Wed, 31 Mar 2021 23:38:58 +0000 (UTC) [thread overview]
Message-ID: <1617233923.06382b00ebd78da1c4968fd78a9bafb82aabff3e.sam@gentoo> (raw)
commit: 06382b00ebd78da1c4968fd78a9bafb82aabff3e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 31 18:32:12 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 31 23:38:43 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06382b00
app-forensics/aflplusplus: initial import
Signed-off-by: Sam James <sam <AT> gentoo.org>
app-forensics/aflplusplus/Manifest | 1 +
app-forensics/aflplusplus/aflplusplus-3.12c.ebuild | 75 ++++++++++++++
.../files/aflplusplus-3.0c-CFLAGS.patch | 110 +++++++++++++++++++++
.../files/aflplusplus-3.0c-LDFLAGS.patch | 11 +++
app-forensics/aflplusplus/metadata.xml | 11 +++
5 files changed, 208 insertions(+)
diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
new file mode 100644
index 00000000000..81c2a1618a1
--- /dev/null
+++ b/app-forensics/aflplusplus/Manifest
@@ -0,0 +1 @@
+DIST aflplusplus-3.12c.tar.gz 2065569 BLAKE2B ff7a87eb02f7731b5ce8e1a3016239c6fd1cd1bfeb0b9c0fb69f72bdbf079e7700cdb32abe64f64853e5ff82f1c0ecd86d2cadb892e7c40be6bb2a7b089f7387 SHA512 a814d61298b60d99388289e742dbedf2ed1ab454a5e1ea20d48bb2f18b36c01553ab1f097a06f733439d67e804d48cb823a82ff249c404fb0b83a281564f3040
diff --git a/app-forensics/aflplusplus/aflplusplus-3.12c.ebuild b/app-forensics/aflplusplus/aflplusplus-3.12c.ebuild
new file mode 100644
index 00000000000..8f54edd03d1
--- /dev/null
+++ b/app-forensics/aflplusplus/aflplusplus-3.12c.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8,9} )
+LLVM_MAX_SLOT=11
+inherit toolchain-funcs llvm python-single-r1
+
+DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
+HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
+SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/AFLplusplus-${PV}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="test"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+# Tests involve heavy use of LD_PRELOAD in some cases
+# This isn't compatible with sandbox
+RESTRICT="test"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ || (
+ sys-devel/llvm:10
+ sys-devel/llvm:11
+ sys-devel/llvm:12
+ )
+"
+DEPEND="
+ ${RDEPEND}
+ test? ( dev-util/cmocka )
+"
+
+QA_PREBUILT="/usr/share/afl/testcases/others/elf/small_exec.elf"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-3.0c-LDFLAGS.patch"
+ "${FILESDIR}/${PN}-3.0c-CFLAGS.patch"
+)
+
+pkg_setup() {
+ llvm_pkg_setup
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ sed -i -e 's/-O3 -fno-unroll-loops//' GNUmakefile || die
+}
+
+src_compile() {
+ emake \
+ CC="$(tc-getCC)" \
+ CFLAGS_FLTO="" \
+ PREFIX="${EPREFIX}/usr" \
+ HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
+ DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
+ MAN_PATH="${EPREFIX}/usr/share/man/man8"
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}"
+ PREFIX="${EPREFIX}/usr" \
+ HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
+ DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
+ MAN_PATH="${EPREFIX}/usr/share/man/man8" \
+ install
+}
diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch b/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch
new file mode 100644
index 00000000000..a3477fd7559
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch
@@ -0,0 +1,110 @@
+--- a/GNUmakefile.gcc_plugin
++++ b/GNUmakefile.gcc_plugin
+@@ -28,14 +28,14 @@ MAN_PATH ?= $(PREFIX)/share/man/man8
+
+ VERSION = $(shell grep '^$(HASH)define VERSION ' ./config.h | cut -d '"' -f2)
+
+-CFLAGS ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
++CFLAGS ?= -D_FORTIFY_SOURCE=2
+ CFLAGS_SAFE := -Wall -Iinclude -Wno-pointer-sign \
+ -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
+ -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
+ -Wno-unused-function
+ override CFLAGS += $(CFLAGS_SAFE)
+
+-CXXFLAGS ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
++CXXFLAGS ?= -D_FORTIFY_SOURCE=2
+ CXXEFLAGS := $(CXXFLAGS) -Wall -std=c++11
+
+ CC ?= gcc
+--- a/GNUmakefile.llvm
++++ b/GNUmakefile.llvm
+@@ -237,7 +237,7 @@ else
+ AFL_CLANG_DEBUG_PREFIX =
+ endif
+
+-CFLAGS ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
++CFLAGS ?= -fPIC -D_FORTIFY_SOURCE=2
+ CFLAGS_SAFE := -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ \
+ -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
+ -DLLVM_BINDIR=\"$(LLVM_BINDIR)\" -DVERSION=\"$(VERSION)\" \
+@@ -254,7 +254,7 @@ ifdef AFL_TRACE_PC
+ $(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
+ endif
+
+-CXXFLAGS ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
++CXXFLAGS ?= -fPIC -D_FORTIFY_SOURCE=2
+ override CXXFLAGS += -Wall -g -I ./include/ \
+ -DVERSION=\"$(VERSION)\" -Wno-variadic-macros \
+ -DLLVM_MINOR=$(LLVM_MINOR) -DLLVM_MAJOR=$(LLVM_MAJOR)
+@@ -434,20 +434,20 @@ afl-llvm-dict2file.so: instrumentation/afl-llvm-dict2file.so.cc instrumentation/
+
+ .PHONY: document
+ document:
+- $(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -O3 -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt.o
+- @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -O3 -Wno-unused-result -m32 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-32.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
+- @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -O3 -Wno-unused-result -m64 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-64.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
++ $(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt.o
++ @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -m32 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-32.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
++ @$(CLANG_BIN) -D_AFL_DOCUMENT_MUTATIONS $(CFLAGS_SAFE) $(CPPFLAGS) $(CLANG_CFL) -Wno-unused-result -m64 -fPIC -c instrumentation/afl-compiler-rt.o.c -o ./afl-compiler-rt-64.o 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; else echo "failed (that's fine)"; fi
+
+ ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
+- $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
++ $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@
+
+ ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
+ @printf "[*] Building 32-bit variant of the runtime (-m32)... "
+- @$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-32.o afl-llvm-rt-32.o; else echo "failed (that's fine)"; fi
++ @$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-32.o afl-llvm-rt-32.o; else echo "failed (that's fine)"; fi
+
+ ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
+ @printf "[*] Building 64-bit variant of the runtime (-m64)... "
+- @$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-64.o afl-llvm-rt-64.o; else echo "failed (that's fine)"; fi
++ @$(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ "$$?" = "0" ]; then echo "success!"; ln -sf afl-compiler-rt-64.o afl-llvm-rt-64.o; else echo "failed (that's fine)"; fi
+
+ .PHONY: test_build
+ test_build: $(PROGS)
+--- a/unicorn_mode/samples/c/Makefile
++++ b/unicorn_mode/samples/c/Makefile
+@@ -35,7 +35,7 @@ clean:
+ rm -rf *.o harness harness-debug
+
+ harness.o: harness.c ../../unicornafl/include/unicorn/*.h
+- ${MYCC} ${CFLAGS} -O3 -c harness.c
++ ${MYCC} ${CFLAGS} -c harness.c
+
+ harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
+ ${MYCC} ${CFLAGS} -g -c harness.c -o $@
+--- a/unicorn_mode/samples/persistent/Makefile
++++ b/unicorn_mode/samples/persistent/Makefile
+@@ -35,7 +35,7 @@ clean:
+ rm -rf *.o harness harness-debug
+
+ harness.o: harness.c ../../unicornafl/include/unicorn/*.h
+- ${MYCC} ${CFLAGS} -O3 -c harness.c
++ ${MYCC} ${CFLAGS} -c harness.c
+
+ harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
+ ${MYCC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
+--- a/utils/afl_untracer/Makefile
++++ b/utils/afl_untracer/Makefile
+@@ -1,7 +1,7 @@
+ ifdef DEBUG
+ OPT=-O0
+ else
+- OPT=-O3
++ OPT?=-O2
+ endif
+
+ all: afl-untracer libtestinstr.so
+--- a/utils/custom_mutators/Makefile
++++ b/utils/custom_mutators/Makefile
+@@ -1,7 +1,7 @@
+ all: libexamplemutator.so
+
+ libexamplemutator.so:
+- $(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -O3 -fPIC -shared -g -I ../../include example.c -o libexamplemutator.so
++ $(CC) $(CFLAGS) -D_FORTIFY_SOURCE=2 -fPIC -shared -g -I ../../include example.c -o libexamplemutator.so
+
+ clean:
+ rm -rf libexamplemutator.so
diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch b/app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch
new file mode 100644
index 00000000000..3e8f4dd92d1
--- /dev/null
+++ b/app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch
@@ -0,0 +1,11 @@
+--- a/GNUmakefile.gcc_plugin
++++ b/GNUmakefile.gcc_plugin
+@@ -129,7 +129,7 @@ afl-common.o: ./src/afl-common.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
+
+ ./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
+- $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
++ $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@ $(LDFLAGS)
+ ln -sf afl-cc afl-gcc-fast
+ ln -sf afl-cc afl-g++-fast
+ ln -sf afl-cc.8 afl-gcc-fast.8
diff --git a/app-forensics/aflplusplus/metadata.xml b/app-forensics/aflplusplus/metadata.xml
new file mode 100644
index 00000000000..2c9221b04d2
--- /dev/null
+++ b/app-forensics/aflplusplus/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">AFLplusplus/AFLplusplus</remote-id>
+ </upstream>
+</pkgmetadata>
next reply other threads:[~2021-03-31 23:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 23:38 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-19 7:28 [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/files/, app-forensics/aflplusplus/ Sam James
2021-09-19 7:28 Sam James
2022-07-07 3:13 Sam James
2022-08-31 4:30 Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1617233923.06382b00ebd78da1c4968fd78a9bafb82aabff3e.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox