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

Update libFuzzer to be from the 'release_90' branch #39

Merged
merged 2 commits into from
Oct 20, 2019

Conversation

alex
Copy link
Member

@alex alex commented Oct 20, 2019

No description provided.

@alex
Copy link
Member Author

alex commented Oct 20, 2019

Looks like this isn't working due to rust-fuzz/cargo-fuzz#161

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

Yep, that is a pre-existing issue.

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

Lets see… do we have bors on this repo?

bors r+

bors bot added a commit that referenced this pull request Oct 20, 2019
39: Update libFuzzer to be from the 'release_90' branch r=nagisa a=alex



Co-authored-by: Alex Gaynor <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 20, 2019

Build failed

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

Okay, we cannot land this without additional work. Attempting to fuzz with the newer versions of libFuzzer results in:

-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

As far as I know rustc has not yet added support for fuzzer sanitization.

@alex
Copy link
Member Author

alex commented Oct 20, 2019

Ahh, of course, I'd forgotten about that.

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

From what I can tell we just need to change the llvm flags that we pass in, but that will still need changes to cargo-fuzz AFAIR

@alex
Copy link
Member Author

alex commented Oct 20, 2019 via email

@alex
Copy link
Member Author

alex commented Oct 20, 2019

Actually, maybe no rustc changes required, since cargo-fuzz seems to just use -Cllvm-args

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

Yeah. I had succeeded in running with the following flags:

cargo rustc --release -- -Cpasses='sancov' \
-Cllvm-args=-sanitizer-coverage-level=4 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
-Cllvm-args=-sanitizer-coverage-inline-8bit-counters \
-Cllvm-args=-sanitizer-coverage-stack-depth \
-Cllvm-args=-sanitizer-coverage-trace-geps \
-Cllvm-args=-sanitizer-coverage-prune-blocks=0 \
-Zsanitizer=address \
-Cpanic=abort


# -Cllvm-args=-sanitizer-coverage-pc-table \

pc-table is something that clang enables but doesn’t work with rustc because of

ERROR: The size of coverage PC tables does not match the
number of instrumented PCs. This might be a compiler bug,
please contact the libFuzzer developers.
Also check https://bugs.llvm.org/show_bug.cgi?id=34636
for possible workarounds (tl;dr: don't use the old GNU ld)

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

@alex can you please adjust the travis scripts to these new flags and also open a PR against cargo-fuzz with a similar change? We can merge everything then.

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

I think upgrading dist from trusty to bionic could also resolve the travis failures.

@alex
Copy link
Member Author

alex commented Oct 20, 2019 via email

@alex
Copy link
Member Author

alex commented Oct 20, 2019

Build appears to be green now!

@alex
Copy link
Member Author

alex commented Oct 20, 2019

I'm working on the cargo-fuzz side now.

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

prune-blocks=0 disables pruning explicitly AFAIR, I don’t see any harm in enabling trace-geps. Everything else seemed to be specified by clang on at least x86-64:

# "/usr/bin/clang-8" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/usr/lib/clang/8.0.0" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/clang/8.0.0/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir" "/tmp" "-ferror-limit" "19" "-fmessage-length" "119" "-stack-protector" "2" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "/tmp/test-5b81de.o" "-x" "c" "test.c" "-faddrsig"

@alex
Copy link
Member Author

alex commented Oct 20, 2019

@alex
Copy link
Member Author

alex commented Oct 20, 2019

This PR includes both GEPs and prune-blocks.

@nagisa
Copy link
Member

nagisa commented Oct 20, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 20, 2019
39: Update libFuzzer to be from the 'release_90' branch r=nagisa a=alex



Co-authored-by: Alex Gaynor <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 20, 2019

Build succeeded

@bors bors bot merged commit 272e484 into rust-fuzz:master Oct 20, 2019
@alex alex deleted the libfuzzer-9.0 branch October 20, 2019 16:20
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

Successfully merging this pull request may close these issues.

2 participants