jazzer
jazzer copied to clipboard
Jazzer does not use libc++
I tried adding jazzer test rules as a http_archive to my WORKSPACE file:
http_archive(
name = "rules_jazzer",
sha256 = "c2b26f80618f51fd7d75e2e8067084f3776f321b596ca2fb19c585f836739bf9",
strip_prefix = "jazzer-0.9.1",
urls = ["https://github.com/CodeIntelligenceTesting/jazzer/archive/refs/tags/v0.9.1.tar.gz"],
)
and then using java_fuzz_target_test
as a test in one of my BUILD files
load("@rules_jazzer//bazel:fuzz_target.bzl", "java_fuzz_target_test")
java_fuzz_target_test(
name = "gateway_controller_fuzz",
....
)
However, it seems that java_fuzz_target_test
adds dependencies on internal targets (e.g. //agent/src/main/java/com/code_intelligence/jazzer/api
), which means that it can't be used in this way.
FWIW, I also suggested that jazzer rules could be added to bazelbuild/rules_fuzzing, so that might be a better place to fix this problem.
Indeed, the current macro is mostly meant for regression testing within Jazzer.
I am quite interested in proper rules_fuzzing though and will see what I can contribute to it.
Jazzer has been integrated into rules_fuzzing
with https://github.com/bazelbuild/rules_fuzzing/pull/143. The java_fuzz_test
macro provided by these rules is even more convenient than java_fuzz_target_test
and can be used by other projects.
@chrismgrayftsinc Have you managed to set up rules_fuzzing
?
Thanks for checking in! I tried to set up a test today but I'm running into issues with C++ compilation. I don't do much C++ development so it's likely I don't have the correct toolchain setup.
(The specific error is to do with std::filesystem
not being found at link time, which appears to be an issue with a too-old libstdc++
)
I will look into ways to resolve this on our end. Some versions of libstdc++
are indeed known to cause problems since they claim to have C++17 support but then don't include std::filesystem
.
Fixing this is blocked by https://github.com/bazelbuild/bazel/issues/13071.
Verified that this issue is resolved by https://github.com/bazelbuild/bazel/pull/13666. Let's see whether we can that merged upstream.
@chrismgrayftsinc If you still want to give this a try, the following should work with latest stable Bazel (4.1.0):
- Add a dependency on Jazzer at commit 41d8027ac73311e129e6227d9205248800af8eb6 before loading the
rules_fuzzing
dependencies. - Execute Bazel with the arguments given in https://github.com/CodeIntelligenceTesting/jazzer/pull/147#issuecomment-878231839.
I'm sorry that this is so difficult right now, but the Bazel story around libc++
is just not very polished.
We are no longer relying on std::filesystem
and am in the process of restoring C++1 compatibility, so this shouldn't be necessary anymore.