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

Jazzer does not use libc++ #79

Closed
chrismgrayftsinc opened this issue Apr 19, 2021 · 8 comments
Closed

Jazzer does not use libc++ #79

chrismgrayftsinc opened this issue Apr 19, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@chrismgrayftsinc
Copy link

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.

@fmeum
Copy link
Contributor

fmeum commented Apr 20, 2021

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.

@fmeum fmeum added the enhancement New feature or request label Apr 21, 2021
@fmeum
Copy link
Contributor

fmeum commented May 11, 2021

Jazzer has been integrated into rules_fuzzing with bazel-contrib/rules_fuzzing#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.

@fmeum fmeum closed this as completed May 11, 2021
@fmeum
Copy link
Contributor

fmeum commented Jul 8, 2021

@chrismgrayftsinc Have you managed to set up rules_fuzzing?

@chrismgrayftsinc
Copy link
Author

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++)

@fmeum
Copy link
Contributor

fmeum commented Jul 9, 2021

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.

@fmeum fmeum reopened this Jul 9, 2021
@fmeum
Copy link
Contributor

fmeum commented Jul 9, 2021

Fixing this is blocked by bazelbuild/bazel#13071.

@fmeum
Copy link
Contributor

fmeum commented Jul 12, 2021

Verified that this issue is resolved by bazelbuild/bazel#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):

  1. Add a dependency on Jazzer at commit 41d8027 before loading the rules_fuzzing dependencies.
  2. Execute Bazel with the arguments given in Use libc++ for building Jazzer #147 (comment).

I'm sorry that this is so difficult right now, but the Bazel story around libc++ is just not very polished.

@fmeum fmeum changed the title java_fuzz_target_test does not work outside of the jazzer repository Jazzer does not use libc++ Jul 15, 2021
@fmeum
Copy link
Contributor

fmeum commented Aug 18, 2022

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.

@fmeum fmeum closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants