aboutsummaryrefslogtreecommitdiff
path: root/bazel/fuzz_target_test_wrapper.sh
diff options
context:
space:
mode:
authorFabian Meumertzheim <meumertzheim@code-intelligence.com>2021-03-22 14:48:58 +0100
committerGitHub <noreply@github.com>2021-03-22 14:48:58 +0100
commit71ac55c6fc9d808bcc8a8e8d895f7f20141bec86 (patch)
treedfa557a023d1413799c24dbd1373d8c42c2ee8bb /bazel/fuzz_target_test_wrapper.sh
parent20d72b43a58f5ffcb807245a854d7eb178c4b8b6 (diff)
downloadjazzer-api-71ac55c6fc9d808bcc8a8e8d895f7f20141bec86.tar.gz
Do not intercept JVM-internal C stdlib calls (#45)
* Replace uses of quick_exit and at_quick_exit quick_exit is not supported on macOS, but can easily replaced by a call to _Exit after running our cleanup manually. * Run buildifier --lint=fix -r . * Build libFuzzer from source Building libFuzzer from source is easy and has multiple advantages: * The clang distributed with XCode on macOS does not include libFuzzer. * Applying a small patch to libFuzzer will allow us to replace the --wrap linker feature, which is not supported on platforms other than Linux. * Replace -Wl,--wrap with a source code patch * Pin non-native rules_python * Print exit code on test failure * Do not intercept JVM-internal C stdlib calls The JVM frequently calls strcmp/memcmp/..., which fills up the table of recent compares with entries that are either duplicates of values already reported by the bytecode instrumentation or JDK-internal strings that are not relevant for fuzzing. This commit adds an ignorelist to the C stdlib interceptors that filters out calls from known JVM libraries. If the fuzz target has not yet loaded a native library, all such callbacks are ignored, which greatly improves fuzzer performance for string-heavy targets. E.g., JsonSanitizerDenylistFuzzer takes < 1 million runs now when it used to take over 3 million.
Diffstat (limited to 'bazel/fuzz_target_test_wrapper.sh')
-rwxr-xr-xbazel/fuzz_target_test_wrapper.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/bazel/fuzz_target_test_wrapper.sh b/bazel/fuzz_target_test_wrapper.sh
index 7a2a9f7f..061ed3ae 100755
--- a/bazel/fuzz_target_test_wrapper.sh
+++ b/bazel/fuzz_target_test_wrapper.sh
@@ -24,5 +24,6 @@ if [ $exit_code -eq 77 ] || [ $exit_code -eq 76 ]
then
exit 0
else
+ echo "Unexpected exit code: $exit_code"
exit 1
fi