Skip to content

Commit

Permalink
Bump to version 0.2.0 and update README/Cargo.toml metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Jan 14, 2020
1 parent 91e2716 commit 7deb572
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
17 changes: 6 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
[package]
name = "libfuzzer-sys"
version = "0.1.0"
authors = ["The cargo-fuzz Project Developers"]
repository = "https://github.com/rust-fuzz/libfuzzer-sys"
license = "MIT/Apache-2.0/NCSA"
authors = ["The rust-fuzz Project Developers"]
edition = "2018"

# cargo-fuzz puts this in a crate subdirectory,
# which causes problems if the crate uses workspaces.
# Create a useless local workspace to break out of this
[workspace]
members = ["."]
license = "MIT/Apache-2.0/NCSA"
name = "libfuzzer-sys"
readme = "./README.md"
repository = "https://github.com/rust-fuzz/libfuzzer"
version = "0.2.0"

[dependencies]
# arbitrary = "0.3"
Expand Down
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
Barebones wrapper around libFuzzer runtime library.
# The `libfuzzer-sys` Crate

Barebones wrapper around LLVM's libFuzzer runtime library.

The CPP parts are extracted from compiler-rt git repository with `git filter-branch`.

libFuzzer relies on LLVM sanitizer support. The Rust compiler has built-in support for LLVM sanitizer support, for now, it's limited to Linux. As a result, libfuzzer-sys only works on Linux.
libFuzzer relies on LLVM sanitizer support. The Rust compiler has built-in support for LLVM sanitizer support, for now, it's limited to Linux. As a result, `libfuzzer-sys` only works on Linux.

## Usage

# How to use
### Use `cargo fuzz`!

Use [cargo-fuzz].
[The recommended way to use this crate with `cargo fuzz`!][cargo-fuzz].

[cargo-fuzz]: https://github.com/rust-fuzz/cargo-fuzz

### Manual Usage

This crate can also be used manually as following:

First create a new cargo project:
Expand All @@ -19,15 +25,15 @@ $ cargo new --bin fuzzed
$ cd fuzzed
```

Then add a dependency on the fuzzer-sys crate and your own crate:
Then add a dependency on the `fuzzer-sys` crate and your own crate:

```toml
[dependencies]
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } # will eventually publish to crates.io
your_crate = "*" # or something
libfuzzer-sys = "0.2.0"
your_crate = { path = "../path/to/your/crate" }
```

and change the `src/main.rs` to fuzz your code:
Change the `fuzzed/src/main.rs` to fuzz your code:

```rust
#![no_main]
Expand All @@ -39,11 +45,19 @@ fuzz_target!(|data: &[u8]| {
});
```

Finally, run the following commands:
Build by running the following command:

```sh
$ cargo rustc -- \
-C passes='sancov' \
-C llvm-args='-sanitizer-coverage-level=3' \
-Z sanitizer=address
```
$ cargo rustc -- -C passes='sancov' -C llvm-args='-sanitizer-coverage-level=3' -Z sanitizer=address
$ ./target/debug/fuzzed # runs fuzzing

And finally, run the fuzzer:

```sh
$ ./target/debug/fuzzed
```

## Updating libfuzzer from upstream
Expand All @@ -55,4 +69,5 @@ $ ./target/debug/fuzzed # runs fuzzing
## License

All files in `libfuzzer` directory are licensed NCSA.

Everything else is dual-licensed Apache 2.0 and MIT.

0 comments on commit 7deb572

Please sign in to comment.