bazelbuild / rules_fuzzing

Bazel Starlark extensions for defining fuzz tests in Bazel projects
Apache License 2.0
81 stars 19 forks source link

Add support for Bzlmod #242

Closed fmeum closed 3 months ago

fmeum commented 5 months ago

Requires fixing a case of a non-hermetic Python import in dict_validation_test that breaks with Python 3.11, with which Bazel uses PYTHONSAFEPATH by default.

A follow-up PR will provide the publishing setup for releases to the Bazel Central Registry (BCR).

Fixes #189

fmeum commented 5 months ago

@stefanbucur This is what's needed to make rules_fuzzing seamless to add as a dependency with Bazel's new dependency management system. I can submit a follow-up change that automates releases to the Bazel Central Registry whenever you create a release.

I pushed an additional commit to work around an issue with OSS-Fuzz builds that I think is unrelated to any changes in this PR. Since today (but not yesterday, see https://github.com/bazelbuild/rules_fuzzing/actions/runs/7535376849), there are new OSS-Fuzz failures that I don't know how to work around. Is it possible that the clang@HEAD used by OSS-Fuzz is broken?

stefanbucur commented 4 months ago

Approving, but some tests seem to be failing.

fmeum commented 4 months ago

@stefanbucur Thanks. I will fix the Bzlmod example shortly, but I'm somewhat clueless about the OSS-Fuzz compilation failure. I'm going to dig deeper later.

fmeum commented 4 months ago

I now think that this is a Bazel limitation: The layering_check feature relies on sandboxing, which the build_bazel_fuzz_test OSS-Fuzz script disables via --spawn_strategy=standalone.

@stefanbucur What do you think of adding --spawn_strategy=sandboxed to the OSS-Fuzz test projects for rules_fuzzing as a workaround? This seems better to me than disabling layering_check.

fmeum commented 4 months ago

I filed https://github.com/bazelbuild/bazel/issues/21592 to track the Bazel issue.

stefanbucur commented 4 months ago

I now think that this is a Bazel limitation: The layering_check feature relies on sandboxing, which the build_bazel_fuzz_test OSS-Fuzz script disables via --spawn_strategy=standalone.

Wow, thanks for digging into this issue - but how did it work before? Is this due to updating the Abseil dependency?

@stefanbucur What do you think of adding --spawn_strategy=sandboxed to the OSS-Fuzz test projects for rules_fuzzing as a workaround? This seems better to me than disabling layering_check.

I think this is a good tradeoff indeed - thank you!

fmeum commented 4 months ago

The OSS-Fuzz change has been merged and the fuzz tests are now compiling, but they are crashing at startup. I will look into that.

fmeum commented 4 months ago

@stefanbucur This is ready now.