Skip to content

Provide prebuilt std artifacts for sanitizers #78533

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
3 tasks
Gankra opened this issue Oct 29, 2020 · 2 comments
Open
3 tasks

Provide prebuilt std artifacts for sanitizers #78533

Gankra opened this issue Oct 29, 2020 · 2 comments
Labels
A-sanitizers Area: Sanitizers for correctness and code quality C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Gankra
Copy link
Contributor

Gankra commented Oct 29, 2020

Based off of discussion in zulip

Rust currently has unstable support for sanitizers (#39699), but some sanitizers require (or prefer) std to be built with special instrumentation. The unstable cargo -Zbuild-std feature was introduced to address this issue, allowing you to ask cargo to rebuild std with your current RUSTFLAGS.

However, this is a bit messy to work with, and produces a lot of redundant work. Especially in the context of CI with vendored environments. It would be nice if prebuilt stds were provided for some configurations.

Sanitizers that merit consideration:

  • ThreadSanitizer (tsan) -- requires an instrumented build to work right
  • MemorySanitizer (msan) -- requires an instrumented built to work right
  • AddressSanitizer (asan) -- can produce more accurate results with an instrumented built

For reference, Firefox is currently only using the -Zsanitizer flag for its "linux64" tsan builds, which I believe are currently debian8-amd64 machines. We have asan tasks in many different configurations, but evidently we haven't yet bothered to use -Zsanitizer for them (presumably because it's not required).

It has been suggested to provide builds for all the tier1 platforms, but I don't personally have an opinion on that.

@Gankra
Copy link
Contributor Author

Gankra commented Oct 29, 2020

Note: some hackery may still be required to avoid proc macros/build.rs from using the tsan std, as rustc will still be uninstrumented and link into them (and there will be missing tsan symbols).

@camelid camelid added A-sanitizers Area: Sanitizers for correctness and code quality T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Oct 29, 2020
@briansmith
Copy link
Contributor

Another possibility is to just do -Zbuild-std implicitly when a (stable) sanitizer is requested. This would require sanitizers to depend on the rust-src component, but I don't think that would be too terrible.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-sanitizers Area: Sanitizers for correctness and code quality C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants