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

Support fuzzing without sanitizers #158

Closed
Shnatsel opened this issue Jun 23, 2018 · 8 comments
Closed

Support fuzzing without sanitizers #158

Shnatsel opened this issue Jun 23, 2018 · 8 comments

Comments

@Shnatsel
Copy link
Member

There are use cases for fuzzing binaries with cargo-fuzz without sanitizers:

  1. Fuzzing entirely safe code to test for panics
  2. Building initial corpus to feed it to more resource-intensive fuzzers later on

However, this is not currently possible with cargo-fuzz: passing no -s flag defaults to address sanitizer, passing "" has no effect, passing "none" says there's no such sanitizer.

For now I'm forced to use leak sanitizer, which seems to be the least resource-hungry of the bunch, but it still introduces a performance penalty. It would be nice to be able to disable sanitizers altogether.

@Manishearth
Copy link
Member

Manishearth commented Jun 23, 2018 via email

@Shnatsel
Copy link
Member Author

According to libfuzzer documentation you only need -fsanitize=fuzzer but not e.g. -fsanitize=fuzzer,address

Or is this something specific to Rust?

@PaulGrandperrin
Copy link
Member

For the record, I can say that it's not related to Rust because honggfuzz-rs works well with and without sanitizer.

@Manishearth
Copy link
Member

No, I think that sanitize option did not exist or was not recommended in the libfuzzer docs when I wrote this crate. Feel free to make it the default.

@Shnatsel
Copy link
Member Author

I think changing the default should result in a major version bump, since it would effectively break existing deployments e.g. on CI that expect Address Sanitizer to be the default.

@dragostis
Copy link

dragostis commented May 14, 2019

-fsanitize=fuzzer is only available on clang, not rustc. libFuzzer requires sanitizers in order to work; when using -fsanitize=fuzzer with clang, I would imagine that it does sanitization as well as linking the fuzzer and creating the fuzz harness.

libFuzzer, however, doesn't seem to support our approach anymore:

-fsanitize-coverage=trace-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

In other words, this doesn't seem feasible unless we add support in rustc.

@kcc
Copy link

kcc commented May 14, 2019

For C/C++, -fsanitize=fuzzer works fine w/o any sanitizers.
However there are some libFuzzer features that will kick in only when coupled with -fsanitize=address,
e.g. interceptors for memcmp.
I have not followed the Rust support for libFuzzer.

@Shnatsel
Copy link
Member Author

This is supported in latest release:

    -s, --sanitizer <sanitizer>    Use a specific sanitizer [default: address]  [possible values: address, leak, memory, thread, none]

Closing.

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

No branches or pull requests

5 participants