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

Force 1 CGU when release mode is enabled #215

Merged
merged 1 commit into from
Feb 1, 2020

Conversation

alexcrichton
Copy link
Contributor

We've locally started setting up OSS fuzz and Rust recently, but we're
unfortunately getting a lot of timeouts where tests are taking much
longer than expected. After some investigation one cause of the issue
seems to be that although we're compiling the fuzzers in release mode
they're still performing quite badly at runtime.

One cause of this appears to be that functions are not being inlined
across CGUs within a crate, and digging even further seems to show that
functions are tagged with notEligibleToImport which presumably means
that ThinLTO cannot import them across CGUs.

Poking around in LLVM it looks like the sancov passes add mutations of a
private __sancov_gen_ global in all functions in a CGU, and then that
global itself is listed as not importable. Any function referencing
something not importable is then also considered not importable, hence
nothing in any CGU is importable.

With this change, however, the performance of optimized-Rust being
sanitized is unfortunately still ~100x slower than non-sanitized Rust. I
don't think the overhead is supposed to be that high so I'm still
looking into other causes of slowness.

We've locally started setting up OSS fuzz and Rust recently, but we're
unfortunately getting a lot of timeouts where tests are taking much
longer than expected. After some investigation one cause of the issue
seems to be that although we're compiling the fuzzers in release mode
they're still performing quite badly at runtime.

One cause of this appears to be that functions are not being inlined
across CGUs within a crate, and digging even further seems to show that
functions are tagged with `notEligibleToImport` which presumably means
that ThinLTO cannot import them across CGUs.

Poking around in LLVM it looks like the sancov passes add mutations of a
private `__sancov_gen_` global in all functions in a CGU, and then that
global itself is listed as not importable. Any function referencing
something not importable is then also considered not importable, hence
nothing in any CGU is importable.

With this change, however, the performance of optimized-Rust being
sanitized is unfortunately still ~100x slower than non-sanitized Rust. I
don't think the overhead is supposed to be that high so I'm still
looking into other causes of slowness.
@alexcrichton
Copy link
Contributor Author

cc @fitzgen, this is related to some of the timeout bugs that we were looking at for wasmtime

@nagisa
Copy link
Member

nagisa commented Feb 1, 2020

Definitely makes sense to do this.

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 1, 2020

Configuration problem

bors.toml: not found

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.

None yet

2 participants