Bug 1671691 - Enable Rust stdlib instrumentation. r=decoder

* Bumps the tsan toolchain to rust-nightly-2020-11-14 that has my patches to make -Zbuild-std work in vendored environments:
  * https://github.com/rust-lang/cargo/pull/8834
  * https://github.com/rust-lang/rust/pull/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
This commit is contained in:
Alexis Beingessner 2020-11-16 18:36:41 +00:00
Родитель f53d2424e1
Коммит 9a0f581986
4 изменённых файлов: 23 добавлений и 21 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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"
// parking_lot using incorrect atomic orderings in RwLock, upstream
// fix already up for review.
"race:StrongRuleNode::ensure_child\n"
// No Bug - permanent
"race:third_party/rust/parking_lot_core/*\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"
@ -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.
}

Просмотреть файл

@ -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',

Просмотреть файл

@ -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\"");