Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-forensics/aflplusplus/, app-forensics/aflplusplus/files/
Date: Tue, 01 Jun 2021 18:33:19
Message-Id: 1622572382.e9da09d6482d95ea8353fe243d2fc8d69535a118.sam@gentoo
1 commit: e9da09d6482d95ea8353fe243d2fc8d69535a118
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 1 18:18:23 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 1 18:33:02 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9da09d6
7
8 app-forensics/aflplusplus: add 3.13c
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 app-forensics/aflplusplus/Manifest | 1 +
13 app-forensics/aflplusplus/aflplusplus-3.13c.ebuild | 97 +++++++++++++++++++++
14 .../files/aflplusplus-3.13c-CFLAGS.patch | 99 ++++++++++++++++++++++
15 3 files changed, 197 insertions(+)
16
17 diff --git a/app-forensics/aflplusplus/Manifest b/app-forensics/aflplusplus/Manifest
18 index 81c2a1618a1..981ff63c53a 100644
19 --- a/app-forensics/aflplusplus/Manifest
20 +++ b/app-forensics/aflplusplus/Manifest
21 @@ -1 +1,2 @@
22 DIST aflplusplus-3.12c.tar.gz 2065569 BLAKE2B ff7a87eb02f7731b5ce8e1a3016239c6fd1cd1bfeb0b9c0fb69f72bdbf079e7700cdb32abe64f64853e5ff82f1c0ecd86d2cadb892e7c40be6bb2a7b089f7387 SHA512 a814d61298b60d99388289e742dbedf2ed1ab454a5e1ea20d48bb2f18b36c01553ab1f097a06f733439d67e804d48cb823a82ff249c404fb0b83a281564f3040
23 +DIST aflplusplus-3.13c.tar.gz 2128787 BLAKE2B 40fa65654468dc1de7f6e1b63d2266915a40d145b7cb91b8b95488bc975804f70887bc1c3718fbd12c76872a0126f3bcc36134eb55ef729060b5efcf93dad424 SHA512 916a714deaf67969c9ac6e90bd2d8015a1e5188c8a8122f4d5d64ce4b841822de65458e469a47d4244358fab5e31ef4e52b8ec1432dcbd60d29aedf15e4c36fe
24
25 diff --git a/app-forensics/aflplusplus/aflplusplus-3.13c.ebuild b/app-forensics/aflplusplus/aflplusplus-3.13c.ebuild
26 new file mode 100644
27 index 00000000000..c665a60d41b
28 --- /dev/null
29 +++ b/app-forensics/aflplusplus/aflplusplus-3.13c.ebuild
30 @@ -0,0 +1,97 @@
31 +# Copyright 1999-2021 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +PYTHON_COMPAT=( python3_{7,8,9} )
37 +LLVM_MAX_SLOT=12
38 +inherit toolchain-funcs llvm optfeature python-single-r1
39 +
40 +DESCRIPTION="A fork of AFL, the popular compile-time instrumentation fuzzer"
41 +HOMEPAGE="https://github.com/AFLplusplus/AFLplusplus"
42 +SRC_URI="https://github.com/AFLplusplus/AFLplusplus/archive/${PV}.tar.gz -> ${P}.tar.gz"
43 +S="${WORKDIR}/AFLplusplus-${PV}"
44 +
45 +LICENSE="Apache-2.0"
46 +SLOT="0"
47 +KEYWORDS="~amd64 ~arm64"
48 +IUSE="test"
49 +
50 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
51 +
52 +# Tests involve heavy use of LD_PRELOAD in some cases
53 +# This isn't compatible with sandbox
54 +RESTRICT="test"
55 +
56 +# It turns out we need Clang too
57 +RDEPEND="
58 + ${PYTHON_DEPS}
59 + >=sys-devel/llvm-10:=
60 + || (
61 + sys-devel/clang:10
62 + sys-devel/clang:11
63 + sys-devel/clang:12
64 + )
65 +"
66 +DEPEND="
67 + ${RDEPEND}
68 + test? ( dev-util/cmocka )
69 +"
70 +
71 +QA_PREBUILT="/usr/share/afl/testcases/others/elf/small_exec.elf"
72 +
73 +PATCHES=(
74 + "${FILESDIR}/${PN}-3.0c-LDFLAGS.patch"
75 + "${FILESDIR}/${PN}-3.13c-CFLAGS.patch"
76 +)
77 +
78 +llvm_check_deps() {
79 + has_version -b "sys-devel/clang:${LLVM_SLOT}" && \
80 + has_version -b "sys-devel/llvm:${LLVM_SLOT}"
81 +}
82 +
83 +pkg_setup() {
84 + llvm_pkg_setup
85 + python-single-r1_pkg_setup
86 +}
87 +
88 +src_prepare() {
89 + default
90 +
91 + sed -i -e 's/-O3 -fno-unroll-loops//' GNUmakefile || die
92 +}
93 +
94 +src_compile() {
95 + emake \
96 + CC="$(tc-getCC)" \
97 + CXX="$(tc-getCXX)" \
98 + CFLAGS_FLTO="" \
99 + PREFIX="${EPREFIX}/usr" \
100 + HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
101 + DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
102 + MAN_PATH="${EPREFIX}/usr/share/man/man8"
103 +}
104 +
105 +src_test() {
106 + emake \
107 + CC="$(tc-getCC)" \
108 + CXX="$(tc-getCXX)"
109 +}
110 +
111 +src_install() {
112 + emake \
113 + CC="$(tc-getCC)" \
114 + CXX="$(tc-getCXX)" \
115 + DESTDIR="${D}" \
116 + PREFIX="${EPREFIX}/usr" \
117 + HELPER_PATH="${EPREFIX}/usr/$(get_libdir)/afl" \
118 + DOC_PATH="${EPREFIX}/usr/share/doc/${PF}" \
119 + MAN_PATH="${EPREFIX}/usr/share/man/man8" \
120 + install
121 +}
122 +
123 +pkg_postinst() {
124 + # TODO: Any others?
125 + optfeature "fuzzing with AFL_USE_ASAN" sys-libs/compiler-rt-sanitizers[asan]
126 + optfeature "fuzzing with AFL_USE_MSAN" sys-libs/compiler-rt-sanitizers[msan]
127 +}
128
129 diff --git a/app-forensics/aflplusplus/files/aflplusplus-3.13c-CFLAGS.patch b/app-forensics/aflplusplus/files/aflplusplus-3.13c-CFLAGS.patch
130 new file mode 100644
131 index 00000000000..a3f54b437b8
132 --- /dev/null
133 +++ b/app-forensics/aflplusplus/files/aflplusplus-3.13c-CFLAGS.patch
134 @@ -0,0 +1,99 @@
135 +--- a/GNUmakefile.gcc_plugin
136 ++++ b/GNUmakefile.gcc_plugin
137 +@@ -28,14 +28,14 @@ MAN_PATH ?= $(PREFIX)/share/man/man8
138 +
139 + VERSION = $(shell grep '^$(HASH)define VERSION ' ./config.h | cut -d '"' -f2)
140 +
141 +-CFLAGS ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
142 ++CFLAGS ?= -D_FORTIFY_SOURCE=2
143 + CFLAGS_SAFE := -Wall -Iinclude -Wno-pointer-sign \
144 + -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
145 + -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
146 + -Wno-unused-function
147 + override CFLAGS += $(CFLAGS_SAFE)
148 +
149 +-CXXFLAGS ?= -O3 -g -funroll-loops -D_FORTIFY_SOURCE=2
150 ++CXXFLAGS ?= -D_FORTIFY_SOURCE=2
151 + CXXEFLAGS := $(CXXFLAGS) -Wall -std=c++11
152 +
153 + CC ?= gcc
154 +--- a/GNUmakefile.llvm
155 ++++ b/GNUmakefile.llvm
156 +@@ -237,7 +237,7 @@ else
157 + AFL_CLANG_DEBUG_PREFIX =
158 + endif
159 +
160 +-CFLAGS ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
161 ++CFLAGS ?= -fPIC -D_FORTIFY_SOURCE=2
162 + CFLAGS_SAFE := -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ \
163 + -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
164 + -DLLVM_BINDIR=\"$(LLVM_BINDIR)\" -DVERSION=\"$(VERSION)\" \
165 +@@ -254,7 +254,7 @@ ifdef AFL_TRACE_PC
166 + $(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
167 + endif
168 +
169 +-CXXFLAGS ?= -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=2
170 ++CXXFLAGS ?= -fPIC -D_FORTIFY_SOURCE=2
171 + override CXXFLAGS += -Wall -g -I ./include/ \
172 + -DVERSION=\"$(VERSION)\" -Wno-variadic-macros \
173 + -DLLVM_MINOR=$(LLVM_MINOR) -DLLVM_MAJOR=$(LLVM_MAJOR)
174 +@@ -434,20 +434,20 @@ afl-llvm-dict2file.so: instrumentation/afl-llvm-dict2file.so.cc instrumentation/
175 +
176 + .PHONY: document
177 + document:
178 +- $(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
179 +- @$(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
180 +- @$(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
181 ++ $(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
182 ++ @$(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
183 ++ @$(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
184 +
185 + ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
186 +- $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
187 ++ $(CC) $(CLANG_CFL) $(CFLAGS_SAFE) $(CPPFLAGS) -Wno-unused-result -fPIC -c $< -o $@
188 +
189 + ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
190 + @printf "[*] Building 32-bit variant of the runtime (-m32)... "
191 +- @$(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
192 ++ @$(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
193 +
194 + ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
195 + @printf "[*] Building 64-bit variant of the runtime (-m64)... "
196 +- @$(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
197 ++ @$(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
198 +
199 + .PHONY: test_build
200 + test_build: $(PROGS)
201 +--- a/unicorn_mode/samples/c/Makefile
202 ++++ b/unicorn_mode/samples/c/Makefile
203 +@@ -35,7 +35,7 @@ clean:
204 + rm -rf *.o harness harness-debug
205 +
206 + harness.o: harness.c ../../unicornafl/include/unicorn/*.h
207 +- ${MYCC} ${CFLAGS} -O3 -c harness.c
208 ++ ${MYCC} ${CFLAGS} -c harness.c
209 +
210 + harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
211 + ${MYCC} ${CFLAGS} -g -c harness.c -o $@
212 +--- a/unicorn_mode/samples/persistent/Makefile
213 ++++ b/unicorn_mode/samples/persistent/Makefile
214 +@@ -35,7 +35,7 @@ clean:
215 + rm -rf *.o harness harness-debug
216 +
217 + harness.o: harness.c ../../unicornafl/include/unicorn/*.h
218 +- ${MYCC} ${CFLAGS} -O3 -c harness.c
219 ++ ${MYCC} ${CFLAGS} -c harness.c
220 +
221 + harness-debug.o: harness.c ../../unicornafl/include/unicorn/*.h
222 + ${MYCC} ${CFLAGS} -DAFL_DEBUG=1 -g -c harness.c -o $@
223 +--- a/utils/afl_untracer/Makefile
224 ++++ b/utils/afl_untracer/Makefile
225 +@@ -1,7 +1,7 @@
226 + ifdef DEBUG
227 + OPT=-O0
228 + else
229 +- OPT=-O3
230 ++ OPT?=-O2
231 + endif
232 +
233 + all: afl-untracer libtestinstr.so