[infra] using -lFuzzingEngine instead of -lfuzzer

This commit is contained in:
Mike Aizatsky 2016-12-07 11:41:08 -08:00
parent ddaa976438
commit 3dd707ed58
30 changed files with 40 additions and 37 deletions

View File

@ -92,7 +92,7 @@ make -j$(nproc) all
$CXX $CXXFLAGS -std=c++11 -Ilib/ \
$SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \
-lfuzzer .libs/libexpat.a
-lFuzzingEngine .libs/libexpat.a
cp $SRC/*.dict $SRC/*.options $OUT/
```
@ -101,12 +101,15 @@ cp $SRC/*.dict $SRC/*.options $OUT/
When build.sh script is executed, the following locations are available within the image:
| Path | Description
| ------ | -----
| `/out/` (`$OUT`) | Directory to store build artifacts (fuzz targets, dictionaries, options files, seed corpus archives).
| `/src/` (`$SRC`) | Directory to checkout source files.
| `/work/`(`$WORK`) | Directory for storing intermediate files |
| `/usr/lib/libfuzzer.a` | Location of prebuilt libFuzzer library that needs to be linked into all fuzz targets (`-lfuzzer`).
| Location|Env| Description |
|---------| -------- | ---------- |
| `/out/` | `$OUT` | Directory to store build artifacts (fuzz targets, dictionaries, options files, seed corpus archives). |
| `/src/` | `$SRC` | Directory to checkout source files |
| `/work/`| `$WORK` | Directory for storing intermediate files |
| `/usr/lib/libFuzzingEngine.a` | `$LIB_FUZZING_ENGINE` | Location of prebuilt fuzzing engine library (e.g. libFuzzer ) that needs to be linked with all fuzz targets (`-lFuzzingEngine`).
While files layout is fixed within a container, the environment variables are
provided to be able to write retargetable scripts.
You *must* use the special compiler flags needed to build your project and fuzz targets.
These flags are provided in the following environment variables:

View File

@ -58,9 +58,9 @@ docker run --rm -ti -e <i>SANITIZER</i>=<i>undefined</i> ossfuzz/sqlite3
| `/out/` | `$OUT` | Directory to store build artifacts (fuzz targets, dictionaries, options files, seed corpus archives). |
| `/src/` | `$SRC` | Directory to checkout source files |
| `/work/`| `$WORK` | Directory for storing intermediate files |
| `/usr/lib/libfuzzer.a` | | Location of prebuilt libFuzzer library that needs to be linked into all fuzz targets (`-lfuzzer`). |
| `/usr/lib/libFuzzingEngine.a` | `$LIB_FUZZING_ENGINE` | Location of prebuilt fuzzing engine library (e.g. libFuzzer ) that needs to be linked with all fuzz targets (`-lFuzzingEngine`).
While files layout is fixed within a container, `$SRC`, `$OUT`, `$WORK` are
While files layout is fixed within a container, the environment variables are
provided to be able to write retargetable scripts.

View File

@ -72,5 +72,5 @@ BUILD_TEMPLATE = """\
# e.g.
# $CXX $CXXFLAGS -std=c++11 -Iinclude \\
# /path/to/name_of_fuzzer.cc -o /out/name_of_fuzzer \\
# -lfuzzer /path/to/library.a
# -lFuzzingEngine /path/to/library.a
"""

View File

@ -34,7 +34,7 @@ for F in $fuzzerFiles; do
fuzzerName=$(basename $F .cc)
echo "Building fuzzer $fuzzerName"
$CXX $CXXFLAGS -std=c++11 \
-o $OUT/${fuzzerName} -lfuzzer $F \
-o $OUT/${fuzzerName} -lFuzzingEngine $F \
-I $SRC/boringssl/include ./ssl/libssl.a ./crypto/libcrypto.a
if [ -d "$SRC/boringssl/fuzz/${fuzzerName}_corpus" ]; then

View File

@ -25,4 +25,4 @@ make -j$(nproc) V=1 all
$CXX $CXXFLAGS -std=c++11 -I. \
$SRC/c_ares_ares_create_query_fuzzer.cc \
-o $OUT/c_ares_ares_create_query_fuzzer \
-lfuzzer $SRC/c-ares/.libs/libcares.a
-lFuzzingEngine $SRC/c-ares/.libs/libcares.a

View File

@ -20,7 +20,7 @@
make -j$(nproc)
$CXX $CXXFLAGS $SRC/curl_fuzzer.cc -Iinclude lib/.libs/libcurl.a \
-o $OUT/curl_fuzzer \
-Wl,-Bstatic -lssl -lcrypto -lz -lfuzzer -Wl,-Bdynamic
-Wl,-Bstatic -lssl -lcrypto -lz -lFuzzingEngine -Wl,-Bdynamic
# /usr/lib/x86_64-linux-gnu/libssl.a \
# /usr/lib/x86_64-linux-gnu/libcrypto.a \

View File

@ -22,6 +22,6 @@ make -j$(nproc) all
$CXX $CXXFLAGS -std=c++11 -Ilib/ \
$SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \
-lfuzzer .libs/libexpat.a
-lFuzzingEngine .libs/libexpat.a
cp $SRC/*.dict $SRC/*.options $OUT/

View File

@ -172,7 +172,7 @@ cd $SRC/ffmpeg
export TEMP_VAR_CODEC="AV_CODEC_ID_H264"
export TEMP_VAR_CODEC_TYPE="VIDEO"
FFMPEG_FUZZERS_COMMON_FLAGS="-lfuzzer /usr/local/lib/libc++.a \
FFMPEG_FUZZERS_COMMON_FLAGS="-lFuzzingEngine /usr/local/lib/libc++.a \
-L$FFMPEG_DEPS_PATH/lib \
-Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample \
-Llibavutil -Llibpostproc -Llibswscale -Llibswresample \

View File

@ -21,7 +21,7 @@ make V=1 all
$CXX $CXXFLAGS -std=c++11 -Isrc/ \
$SRC/magic_fuzzer.cc -o $OUT/magic_fuzzer \
-lfuzzer ./src/.libs/libmagic.a
-lFuzzingEngine ./src/.libs/libmagic.a
cp ./magic/magic.mgc $OUT/

View File

@ -24,6 +24,6 @@ make -j$(nproc) all
$CXX $CXXFLAGS -std=c++11 \
-I./include -I. \
./src/tools/ftfuzzer/ftfuzzer.cc -o $OUT/ftfuzzer \
./objs/*.o -lfuzzer \
./objs/*.o -lFuzzingEngine \
/usr/lib/x86_64-linux-gnu/libarchive.a \
./objs/.libs/libfreetype.a

View File

@ -24,5 +24,5 @@ make -C src V=1 fuzzing
$CXX $CXXFLAGS -std=c++11 -Isrc \
./test/fuzzing/hb-fuzzer.cc -o $OUT/hb-fuzzer \
-lfuzzer ./src/.libs/libharfbuzz-fuzzing.a
-lFuzzingEngine ./src/.libs/libharfbuzz-fuzzing.a

View File

@ -42,7 +42,7 @@ for fuzzer in $FUZZERS; do
$CXX $CXXFLAGS -std=c++11 \
$SRC/$fuzzer.cc -o $OUT/$fuzzer \
-I$SRC/icu/source/common -I$SRC/icu/source/i18n -L$WORK/icu/lib \
-lfuzzer -licui18n -licuuc -licutu -licudata
-lFuzzingEngine -licui18n -licuuc -licutu -licudata
done
cp $SRC/*.dict $SRC/*.options $OUT/

View File

@ -17,6 +17,6 @@
$CXX $CXXFLAGS -std=c++11 -Isrc/ \
$SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \
-lfuzzer
-lFuzzingEngine
cp $SRC/*.options $OUT/

View File

@ -26,7 +26,7 @@ for F in $FUZZERS; do
$SRC/$F.c -o $SRC/$F.o
$CXX $CXXFLAGS \
$SRC/$F.o -o $OUT/$F \
-lfuzzer src/.libs/liblcms2.a
-lFuzzingEngine src/.libs/liblcms2.a
done
cp $SRC/icc.dict $SRC/*.options $OUT/

View File

@ -23,6 +23,6 @@ make -j$(nproc) all
# build fuzzer(s)
$CXX $CXXFLAGS -Ilibarchive \
$SRC/libarchive_fuzzer.cc -o $OUT/libarchive_fuzzer \
-lfuzzer .libs/libarchive.a \
-lFuzzingEngine .libs/libarchive.a \
-Wl,-Bstatic -lbz2 -llzo2 -lxml2 -llzma -lz -lcrypto -llz4 -licuuc \
-licudata -Wl,-Bdynamic

View File

@ -29,7 +29,7 @@ make -j$(nproc)
$CXX $CXXFLAGS -std=c++11 -I$SRC/libass \
$SRC/libass_fuzzer.cc -o $OUT/libass_fuzzer \
-lfuzzer libass/.libs/libass.a \
-lFuzzingEngine libass/.libs/libass.a \
-Wl,-Bstatic -lfontconfig -lfribidi -lfreetype -lz -lpng12 \
-lexpat -Wl,-Bdynamic

View File

@ -32,7 +32,7 @@ for variant in default random_init dynamic_config; do
-o $OUT/chewing_${variant}_fuzzer \
$WORK/chewing_${variant}_fuzzer.o $WORK/chewing_fuzzer_common.o \
test/stress.o test/.libs/libtesthelper.a src/.libs/libchewing.a \
-lfuzzer
-lFuzzingEngine
done
# install data files

View File

@ -21,6 +21,6 @@ make "-j$(nproc)"
$CXX $CXXFLAGS -std=c++11 -I. \
$SRC/libjpeg_turbo_fuzzer.cc -o $OUT/libjpeg_turbo_fuzzer \
-lfuzzer ./.libs/libturbojpeg.a
-lFuzzingEngine ./.libs/libturbojpeg.a
cp $SRC/libjpeg_turbo_fuzzer_seed_corpus.zip $OUT/

View File

@ -29,6 +29,6 @@ make -j$(nproc) all
# build libpng_read_fuzzer
$CXX $CXXFLAGS -std=c++11 -I. -lz \
$SRC/libpng_read_fuzzer.cc -o $OUT/libpng_read_fuzzer \
-lfuzzer .libs/libpng16.a
-lFuzzingEngine .libs/libpng16.a
cp $SRC/*.dict $SRC/*.options $OUT/

View File

@ -22,4 +22,4 @@ CFLAGS="$CFLAGS -D__unused=" pmake -C libteken libteken.a
$CC $CFLAGS -c $SRC/libteken_fuzzer.c -o $SRC/libteken_fuzzer.o -I.
$CXX $CXXFLAGS $SRC/libteken_fuzzer.o \
-o $OUT/libteken_fuzzer \
-lfuzzer libteken/libteken.a
-lFuzzingEngine libteken/libteken.a

View File

@ -26,4 +26,4 @@ $CXX $CXXFLAGS \
-o $OUT/libtsm_fuzzer \
$SRC/libtsm_fuzzer.o \
.libs/libtsm.a \
-lfuzzer
-lFuzzingEngine

View File

@ -24,7 +24,7 @@ make -j$(nproc) all
for fuzzer in libxml2_xml_read_memory_fuzzer libxml2_xml_regexp_compile_fuzzer; do
$CXX $CXXFLAGS -std=c++11 -Iinclude/ \
$SRC/$fuzzer.cc -o $OUT/$fuzzer \
-lfuzzer .libs/libxml2.a
-lFuzzingEngine .libs/libxml2.a
done
cp $SRC/*.dict $SRC/*.options $OUT/

View File

@ -23,7 +23,7 @@ make "-j$(nproc)"
$CXX $CXXFLAGS -std=c++11 -Iinclude \
$SRC/libyaml_fuzzer.cc -o $OUT/libyaml_fuzzer \
-lfuzzer src/.libs/libyaml.a
-lFuzzingEngine src/.libs/libyaml.a
cp $SRC/libyaml_fuzzer_seed_corpus.zip $OUT/
cp $SRC/*.dict $SRC/*.options $OUT/

View File

@ -54,7 +54,7 @@ FUZZERS="asn1_algorithmid_fuzzer \
for fuzzer in $FUZZERS; do
$CXX $CXXFLAGS -std=c++11 $SRC/$fuzzer.cc \
-I$WORK/nss/include \
-lfuzzer \
-lFuzzingEngine \
$WORK/nss/lib/libnss.a $WORK/nss/lib/libnssutil.a \
$WORK/nss/lib/libnspr4.a $WORK/nss/lib/libplc4.a $WORK/nss/lib/libplds4.a \
$WORK/nss/lib/prlog2.o -o $OUT/$fuzzer

View File

@ -24,7 +24,7 @@ make libots.a libwoff2.a libbrotli.a
# Build the fuzzer.
$CXX $CXXFLAGS -std=c++11 -Iinclude \
$SRC/ots_fuzzer.cc -o $OUT/ots_fuzzer \
-lfuzzer -lz $SRC/ots/libots.a $SRC/ots/libwoff2.a $SRC/ots/libbrotli.a
-lFuzzingEngine -lz $SRC/ots/libots.a $SRC/ots/libwoff2.a $SRC/ots/libbrotli.a
cp $SRC/ots_fuzzer.options $OUT/
zip $OUT/ots_fuzzer_seed_corpus.zip $SRC/seed_corpus/*

View File

@ -25,4 +25,4 @@ make -j$(nproc) all
# build fuzzer
$CXX $CXXFLAGS -o $OUT/pcre2_fuzzer \
-lfuzzer .libs/libpcre2-fuzzsupport.a .libs/libpcre2-8.a
-lFuzzingEngine .libs/libpcre2-fuzzsupport.a .libs/libpcre2-8.a

View File

@ -29,6 +29,6 @@ make -j$(nproc) obj/libre2.a
# Second, build the fuzzer (distributed with RE2).
$CXX $CXXFLAGS -std=c++11 -I. \
re2/fuzzing/re2_fuzzer.cc -o $OUT/re2_fuzzer \
-lfuzzer obj/libre2.a
-lFuzzingEngine obj/libre2.a
cp $SRC/*.options $OUT/

View File

@ -32,7 +32,7 @@ $CC $CFLAGS -I. -c \
$CXX $CXXFLAGS \
$SRC/sqlite3/test/ossfuzz.o -o $OUT/ossfuzz \
-lfuzzer ./sqlite3.o
-lFuzzingEngine ./sqlite3.o
cp $SRC/*.options $SRC/*.dict $SRC/*.zip $OUT/

View File

@ -36,6 +36,6 @@ rm src/woff2_compress.o src/woff2_decompress.o
fuzzer=convert_woff2ttf_fuzzer
$CXX $CXXFLAGS -std=c++11 -Isrc \
$SRC/$fuzzer.cc -o $OUT/$fuzzer \
-lfuzzer src/*.o brotli/dec/*.o brotli/enc/*.o
-lFuzzingEngine src/*.o brotli/dec/*.o brotli/enc/*.o
cp $SRC/*.options $OUT/

View File

@ -6,4 +6,4 @@ make -j$(nproc) all
$CXX $CXXFLAGS -std=c++11 -I. \
$SRC/zlib_uncompress_fuzzer.cc -o $OUT/zlib_uncompress_fuzzer \
-lfuzzer ./libz.a
-lFuzzingEngine ./libz.a