Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
Bug 1671691 - Enable Rust stdlib instrumentation. r=decoder
Browse files Browse the repository at this point in the history
* Bumps the tsan toolchain to rust-nightly-2020-11-14 that has my patches to make -Zbuild-std work in vendored environments:
  * rust-lang/cargo#8834
  * rust-lang/rust#78790

* Passes -Zbuild-std to cargo when MOZ_TSAN is defined (mk_add_options --enable-thread-sanitizer)

* Removes generic Rust supressions and adds much more specific ones
    * One presumed upstream false positive from tsan not understanding the code
    * One actual upstream bug tsan found (yay!)
    * One new real issue uncovered
    * One issue that probably already existed intermittently but I happened to hit

Differential Revision: https://phabricator.services.mozilla.com/D97165
  • Loading branch information
Gankra committed Nov 16, 2020
1 parent b047193 commit 28415b9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
5 changes: 4 additions & 1 deletion config/makefiles/rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ ifeq (1,$(MOZ_PARALLEL_BUILD))
cargo_build_flags += -j1
endif

# This should also be paired with -Zbuild-std, but that doesn't work yet.
# We also need to rebuild the rust stdlib so that it's instrumented. Because
# build-std is still pretty experimental, we need to explicitly request
# the panic_abort crate for `panic = "abort"` support.
ifdef MOZ_TSAN
cargo_build_flags += -Zbuild-std=std,panic_abort
RUSTFLAGS += -Zsanitizer=thread
endif

Expand Down
35 changes: 17 additions & 18 deletions mozglue/build/TsanOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,18 @@ extern "C" const char* __tsan_default_suppressions() {
// up due to "volatile" being too weak for this.
"race:third_party/sqlite3/*\n"
"deadlock:third_party/sqlite3/*\n"





// Lack of proper instrumentation for the Rust stdlib (fix this!).
// Bug 1674770 - permanent
// Upstream Bug: https://github.com/Amanieu/parking_lot/issues/257
//
// All of these can potentially be removed if we fix Bug 1671691.

// Bug 1587513 - permanent
"race:std::sync::mutex::Mutex\n"
// Bug 1590423 - permanent
"race:sync..Arc\n"
"race:alloc::sync::Arc\n"
// No Bug - permanent
"race:third_party/rust/parking_lot_core/*\n"
// parking_lot using incorrect atomic orderings in RwLock, upstream
// fix already up for review.
"race:StrongRuleNode::ensure_child\n"
// No Bug - permanent
"race:/rustc/*.rs\n"
"deadlock:/rustc/*.rs\n"
"thread:std::sys::unix::thread::Thread::new\n"
// Upstream Bug: https://github.com/rayon-rs/rayon/issues/812
//
// Probably a false-positive from crossbeam's deque not being
// understood by tsan.
"race:crossbeam_deque::Worker$LT$T$GT$::resize\n"



Expand Down Expand Up @@ -311,6 +303,13 @@ extern "C" const char* __tsan_default_suppressions() {
"race:VRShMem::PullSystemState\n"
"race:VRShMem::PushSystemState\n"

// Bug 1674776
"race:DocumentTimeline::GetCurrentTimeAsDuration\n"

// Bug 1674835
"race:nsHttpTransaction::ReadSegments\n"
"race:nsHttpTransaction::SecurityInfo\n"

// End of suppressions.
; // Please keep this semicolon.
}
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/ci/toolchain/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ linux64-rust-nightly:
arguments: [
# Last nightly with version 1.48.0. See bug #1672094 why
# we're using this rather than the first with version 1.48.0.
'--channel', 'nightly-2020-10-03',
'--channel', 'nightly-2020-11-14',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',
Expand Down
2 changes: 1 addition & 1 deletion toolkit/library/rust/shared/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_version::{version, Version};
fn main() {
let ver = version().unwrap();
let mut bootstrap = false;
let max_oom_hook_version = Version::parse("1.50.0-alpha").unwrap();
let max_oom_hook_version = Version::parse("1.51.0-alpha").unwrap();

if ver >= Version::parse("1.28.0-alpha").unwrap() && ver < max_oom_hook_version {
println!("cargo:rustc-cfg=feature=\"oom_with_hook\"");
Expand Down

0 comments on commit 28415b9

Please sign in to comment.