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

old libfuzzer used in CI #4403

Open
jmayclin opened this issue Feb 5, 2024 · 0 comments
Open

old libfuzzer used in CI #4403

jmayclin opened this issue Feb 5, 2024 · 0 comments

Comments

@jmayclin
Copy link
Contributor

jmayclin commented Feb 5, 2024

Problem:

Our fuzz tests are very old and can't be compiled under modern versions of Clang (libFuzzer). While we seem to be using a relatively modern version of Clang in our CI fuzz tests, the actual fuzzer that we link against looks to be quite old.

Solution:

Brittle Linking

When trying to build locally, the first error encountered is

clang-15: error: no such file or directory: '../../fuzz_dependencies/lib/libFuzzer.a'

This is because we manually locate the libFuzzer dependency. That is not necessary and overly brittle.

Recent versions of Clang (starting from 6.0) include libFuzzer, and no extra installation is necessary.
-- https://llvm.org/docs/LibFuzzer.html#fuzzer-usage

We should instead link against the fuzzer by specifying -fsanitizer=fuzzer

Fortify Source Conflicts

Our fuzz tests are compiled without optimization -O0, but this doesn't seem to work with modern builds.

/usr/include/features.h:412:4: error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
#  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
   ^

PC Guard

The above steps are enough to compile the tests successfully, but when attempting to run them the following error is encountered

-pc-guard is no longer supported by libFuzzer.
Please either migrate to a compiler that supports -fsanitize=fuzzer
or use an older version of libFuzzer
FAILED  tests,  test/sec,      0 features covered

Further Errors

There may be additional errors. I stopped my debugging here because it was enough for my to address the failing fuzz build for #4399

Requirements / Acceptance Criteria:

  • fuzz tests should be run with >= Clang 17 and a similarly new libfuzzer

Out of scope:

I'd love to see our fuzz tests moved to CMake, but that isn't a strict requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants