Skip to content

Commit 9a0f581

Browse files
committed
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: * 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
1 parent f53d242 commit 9a0f581

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

config/makefiles/rust.mk

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ ifeq (1,$(MOZ_PARALLEL_BUILD))
5353
cargo_build_flags += -j1
5454
endif
5555

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

mozglue/build/TsanOptions.cpp

+17-18
Original file line numberDiff line numberDiff line change
@@ -168,26 +168,18 @@ extern "C" const char* __tsan_default_suppressions() {
168168
// up due to "volatile" being too weak for this.
169169
"race:third_party/sqlite3/*\n"
170170
"deadlock:third_party/sqlite3/*\n"
171-
172-
173-
174-
175-
176-
// Lack of proper instrumentation for the Rust stdlib (fix this!).
171+
// Bug 1674770 - permanent
172+
// Upstream Bug: https://github.com/Amanieu/parking_lot/issues/257
177173
//
178-
// All of these can potentially be removed if we fix Bug 1671691.
179-
180-
// Bug 1587513 - permanent
181-
"race:std::sync::mutex::Mutex\n"
182-
// Bug 1590423 - permanent
183-
"race:sync..Arc\n"
184-
"race:alloc::sync::Arc\n"
185-
// No Bug - permanent
186-
"race:third_party/rust/parking_lot_core/*\n"
174+
// parking_lot using incorrect atomic orderings in RwLock, upstream
175+
// fix already up for review.
176+
"race:StrongRuleNode::ensure_child\n"
187177
// No Bug - permanent
188-
"race:/rustc/*.rs\n"
189-
"deadlock:/rustc/*.rs\n"
190-
"thread:std::sys::unix::thread::Thread::new\n"
178+
// Upstream Bug: https://github.com/rayon-rs/rayon/issues/812
179+
//
180+
// Probably a false-positive from crossbeam's deque not being
181+
// understood by tsan.
182+
"race:crossbeam_deque::Worker$LT$T$GT$::resize\n"
191183

192184

193185

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

306+
// Bug 1674776
307+
"race:DocumentTimeline::GetCurrentTimeAsDuration\n"
308+
309+
// Bug 1674835
310+
"race:nsHttpTransaction::ReadSegments\n"
311+
"race:nsHttpTransaction::SecurityInfo\n"
312+
314313
// End of suppressions.
315314
; // Please keep this semicolon.
316315
}

taskcluster/ci/toolchain/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ linux64-rust-nightly:
4848
arguments: [
4949
# Last nightly with version 1.48.0. See bug #1672094 why
5050
# we're using this rather than the first with version 1.48.0.
51-
'--channel', 'nightly-2020-10-03',
51+
'--channel', 'nightly-2020-11-14',
5252
'--host', 'x86_64-unknown-linux-gnu',
5353
'--target', 'x86_64-unknown-linux-gnu',
5454
'--target', 'i686-unknown-linux-gnu',

toolkit/library/rust/shared/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_version::{version, Version};
99
fn main() {
1010
let ver = version().unwrap();
1111
let mut bootstrap = false;
12-
let max_oom_hook_version = Version::parse("1.50.0-alpha").unwrap();
12+
let max_oom_hook_version = Version::parse("1.51.0-alpha").unwrap();
1313

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

0 commit comments

Comments
 (0)