Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and simplify Jazzer integration #218

Merged
merged 4 commits into from
Jul 7, 2023

Conversation

fmeum
Copy link
Member

@fmeum fmeum commented Nov 21, 2022

This commit updates Jazzer to v0.17.1 and restores compatibility with OSS-Fuzz after its recent Jazzer update.

Since Jazzer can now be run directly as a java_binary obtained from Maven, the setup required for java_fuzz_test has been simplified:

  • Jazzer can now be used without extra WORKSPACE setup.
  • The Jazzer runtime is represented as an engine analogous to the case of C++ fuzz engines.
  • Since Jazzer now loads the correct sanitizer runtimes at runtime, it's no longer necessary to use different Jazzer binaries depending on the sanitizer setting. Logic is added to collect the runtimes from the C++ toolchain at build time and add them to Jazzer's runfiles.

The Jazzer update also makes rules_fuzzing compatible with Bazel 6.

@fmeum fmeum force-pushed the update-jazzer branch 12 times, most recently from b564483 to 57eea1c Compare November 23, 2022 14:59
@fmeum fmeum force-pushed the update-jazzer branch 2 times, most recently from c81bfd2 to cbc8776 Compare June 13, 2023 07:07
@fmeum fmeum changed the title Update jazzer Update and simplify Jazzer integration Jun 30, 2023
@fmeum fmeum marked this pull request as ready for review June 30, 2023 15:53
@fmeum
Copy link
Member Author

fmeum commented Jun 30, 2023

@stefanbucur Could you review? Let me know if you want me to add more information about what changed in Jazzer and how it affects rules_fuzzing.

fuzzing/repositories.bzl Show resolved Hide resolved
fuzzing/private/runtime/clang_runtime_lib.bzl Show resolved Hide resolved
Comment on lines 21 to 49
clang_runtime_lib(
name = "asan_linux",
basenames = [
# LLVM 15+
"libclang_rt.asan.so",
# LLVM 14 and earlier
"libclang_rt.asan-x86_64.so",
],
)

clang_runtime_lib(
name = "asan_macos",
basenames = ["libclang_rt.asan_osx_dynamic.dylib"],
)

clang_runtime_lib(
name = "ubsan_linux",
basenames = [
# LLVM 15+
"libclang_rt.ubsan_standalone.so",
# LLVM 14 and earlier
"libclang_rt.ubsan_standalone-x86_64.so",
],
)

clang_runtime_lib(
name = "ubsan_macos",
basenames = ["libclang_rt.ubsan_osx_dynamic.dylib"],
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these rules always be defined? I believe Bazel supports specifying compatibility criteria: https://bazel.build/extending/platforms#skipping-incompatible-targets

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but that doesn't factor into target selection, it just improves error messages and makes wildcard builds pass. Here, I had tags = ["manual"] in the macro, which was arguably too magic - I moved it out into the BUILD file.

visibility = ["//visibility:public"],
)

java_library(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe explain in a comment the role of this rule? It seems to provide no functionality?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment.

@stefanbucur stefanbucur merged commit d93363c into bazel-contrib:master Jul 7, 2023
@fmeum fmeum deleted the update-jazzer branch July 10, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants