2019-11-12 05:17:32 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This file builds multiple variants of the fuzzers
|
|
|
|
# - different sanitizers
|
|
|
|
# - different build options
|
|
|
|
# - reproduce build, for running through valgrind
|
|
|
|
|
|
|
|
# fail on error
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
unset CXX CC CFLAGS CXXFLAGS LDFLAGS
|
|
|
|
|
2019-12-28 02:42:44 +08:00
|
|
|
me=$(basename $0)
|
|
|
|
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
# common options
|
|
|
|
COMMON="-GNinja -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_C_COMPILER=clang-9 -DSIMDJSON_BUILD_STATIC=On -DENABLE_FUZZING=On -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_GIT=Off"
|
2019-11-12 05:17:32 +08:00
|
|
|
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
# A replay build, as plain as it gets. For use with valgrind/gdb.
|
|
|
|
variant=replay
|
2019-11-12 05:17:32 +08:00
|
|
|
if [ ! -d build-$variant ] ; then
|
|
|
|
mkdir build-$variant
|
|
|
|
cd build-$variant
|
|
|
|
|
|
|
|
cmake .. \
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
$COMMON \
|
2019-11-12 05:17:32 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DSIMDJSON_FUZZ_LINKMAIN=On
|
|
|
|
|
2020-04-28 04:02:19 +08:00
|
|
|
ninja all_fuzzers
|
2019-11-12 05:17:32 +08:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
# A fuzzer with sanitizers. For improved capability to find bugs.
|
|
|
|
variant=sanitizers
|
2019-11-12 05:17:32 +08:00
|
|
|
|
2019-12-28 02:42:44 +08:00
|
|
|
if [ ! -d build-$variant ] ; then
|
|
|
|
|
|
|
|
mkdir build-$variant
|
|
|
|
cd build-$variant
|
|
|
|
|
|
|
|
cmake .. \
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
$COMMON \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fsanitize=fuzzer-no-link,address,undefined -fno-sanitize-recover=undefined" \
|
|
|
|
-DCMAKE_C_FLAGS="-fsanitize=fuzzer-no-link,address,undefined -fno-sanitize-recover=undefined" \
|
2019-12-28 02:42:44 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
-DSIMDJSON_FUZZ_LDFLAGS="-fsanitize=fuzzer"
|
2019-12-28 02:42:44 +08:00
|
|
|
|
2020-04-28 04:02:19 +08:00
|
|
|
ninja all_fuzzers
|
2019-12-28 02:42:44 +08:00
|
|
|
cd ..
|
|
|
|
fi
|
2019-11-12 05:17:32 +08:00
|
|
|
|
|
|
|
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
|
|
|
|
# A fast fuzzer, for fast exploration rather than finding bugs.
|
|
|
|
variant=fast
|
|
|
|
if [ ! -d build-$variant ] ; then
|
2019-12-28 02:42:44 +08:00
|
|
|
|
|
|
|
mkdir build-$variant
|
|
|
|
cd build-$variant
|
|
|
|
|
|
|
|
cmake .. \
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
$COMMON \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fsanitize=fuzzer-no-link" \
|
|
|
|
-DCMAKE_C_FLAGS="-fsanitize=fuzzer-no-link" \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2019-12-28 02:42:44 +08:00
|
|
|
-DSIMDJSON_FUZZ_LINKMAIN=Off \
|
add multi implementation fuzzer (#1162)
This adds a fuzzer which parses the same input using all the available implementations (haswell, westmere, fallback on x64).
This should get the otherwise uncovered sourcefiles (mostly fallback) to show up in the fuzz coverage.
For instance, the fallback directory has only one line covered.
As of the 20200909 report, 1866 lines are covered out of 4478.
Also, it will detect if the implementations behave differently:
by making sure they all succeed, or all error
turning the parsed data into text again, should produce equal results
While at it, I corrected some minor things:
clean up building too many variants, run with forced implementation (closes #815 )
always store crashes as artefacts, good in case the fuzzer finds something
return value of the fuzzer function should always be 0
reduce log spam
introduce max size for the seed corpus and the CI fuzzer
2020-09-12 05:46:22 +08:00
|
|
|
-DSIMDJSON_FUZZ_LDFLAGS="-fsanitize=fuzzer"
|
2019-12-28 02:42:44 +08:00
|
|
|
|
2020-04-28 04:02:19 +08:00
|
|
|
ninja all_fuzzers
|
2019-12-28 02:42:44 +08:00
|
|
|
cd ..
|
|
|
|
fi
|