summaryrefslogtreecommitdiff
path: root/app-forensics/aflplusplus
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-04-28 20:21:43 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-04-28 20:21:43 +0100
commit40aaaa64e86ba6710bbeb31c4615a6ce80e75e11 (patch)
tree758c221bad35c9288d0bd6df9c7dfc226728e52c /app-forensics/aflplusplus
parent8d5dbd847cbc704a6a06405856e94b461011afe3 (diff)
gentoo resync : 28.04.2021
Diffstat (limited to 'app-forensics/aflplusplus')
-rw-r--r--app-forensics/aflplusplus/Manifest5
-rw-r--r--app-forensics/aflplusplus/aflplusplus-3.12c-r2.ebuild97
-rw-r--r--app-forensics/aflplusplus/files/aflplusplus-3.0c-CFLAGS.patch110
-rw-r--r--app-forensics/aflplusplus/files/aflplusplus-3.0c-LDFLAGS.patch11
-rw-r--r--app-forensics/aflplusplus/metadata.xml11
5 files changed, 234 insertions, 0 deletions
diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
new file mode 100644
index 000000000000..b4096d96ae0e
--- /dev/null
+++ b/app-forensics/aflplusplus/Manifest
@@ -0,0 +1,5 @@
+AUX aflplusplus-3.0c-CFLAGS.patch 6130 BLAKE2B 24e7d6e04a258dab3353cc82fe7263f99c176fef6abb556678534dc2b92996b5a212a8cc0516a79a73615759b88bd62f137ebb10df0eb6d0a7efddf10d15e2fa SHA512 bdf6786c1ce5613ef598a1c6f7a2371b200409431677a8c4673ccde40c7780df46865b45472cae31659c793e4ff5ebd49805b922c8c6964d2c868c3353498e75
+AUX aflplusplus-3.0c-LDFLAGS.patch 445 BLAKE2B cfb1282dcba575ed96f355bf6695896f69625b1ace2c6b5d02a0c507fc2a09d4ee6cba97d27f7ac08516a525e5a09c5d3cfab75f3c3f4421357c8aa2cc5aee8c SHA512 d3f43709debf92a0a51077c33c85cf16d9e74324999267c66765f4eeda46d0091ee5c08a6e94bdb635ee6f970445c06e0ac1fdceba561c9345670ef7e365dfb0
+DIST aflplusplus-3.12c.tar.gz 2065569 BLAKE2B ff7a87eb02f7731b5ce8e1a3016239c6fd1cd1bfeb0b9c0fb69f72bdbf079e7700cdb32abe64f64853e5ff82f1c0ecd86d2cadb892e7c40be6bb2a7b089f7387 SHA512 a814d61298b60d99388289e742dbedf2ed1ab454a5e1ea20d48bb2f18b36c01553ab1f097a06f733439d67e804d48cb823a82ff249c404fb0b83a281564f3040
+EBUILD aflplusplus-3.12c-r2.ebuild 2119 BLAKE2B d082ef6d5c1fc9a90a087458b3a4d1dedfb0e6adb92573049168b771c112aad6b24e23aaf6554d7bb0aa6d9880e6bd8612afb760f6dbe36a4f0ca79481f084de SHA512 1571af2293395df0da008472f0dfb7a7c798f5a8d544e2d2e7c47cf5070485f3e7624e035dde22cf697b65a3acfeee5e56c0010686eadef497590ae64d6126c5
+MISC metadata.xml 327 BLAKE2B 25fff77dada492976b7c412879dadd7df2a78a05cfa2be3ef00557f84c3f6679dd2977c8ea11573ffda864b0c88da327ea912a358a2b44b4186c71c6ed7086e8 SHA512 b2c58af252bae6ba27785f059c67edbd7c05469965e67c5e6f053bd385463b5f02b2ee65df3174fda85dfcf741add66bbc33836b3d8edb76acec91727f008746
diff --git a/app-forensics/aflplusplus/aflplusplus-3.12c-r2.ebuild b/app-forensics/aflplusplus/aflplusplus-3.12c-r2.ebuild
new file mode 100644
index 000000000000..c2f64e5af6d4
--- /dev/null
+++ b/app-forensics/aflplusplus/aflplusplus-3.12c-r2.ebuild
@@ -0,0 +1,97 @@
+# 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=12
+inherit toolchain-funcs llvm optfeature 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 ~arm64"
+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"
+
+# It turns out we need Clang too
+RDEPEND="
+ ${PYTHON_DEPS}
+ >=sys-devel/llvm-10:=
+ || (
+ sys-devel/clang:10
+ sys-devel/clang:11
+ sys-devel/clang: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"
+)
+
+llvm_check_deps() {
+ has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
+ has_version -b "sys-devel/llvm:${LLVM_SLOT}"
+}
+
+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)" \
+ CXX="$(tc-getCXX)" \
+ 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_test() {
+ emake \
+ CC="$(tc-getCC)" \
+ CXX="$(tc-getCXX)"
+}
+
+src_install() {
+ emake \
+ CC="$(tc-getCC)" \
+ CXX="$(tc-getCXX)" \
+ 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
+}
+
+pkg_postinst() {
+ # TODO: Any others?
+ optfeature "fuzzing with AFL_USE_ASAN" sys-libs/compiler-rt-sanitizers[asan]
+ optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
+}
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 000000000000..a3477fd7559f
--- /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 000000000000..3e8f4dd92d1a
--- /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 000000000000..2c9221b04d2e
--- /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>