Skip to content

Commit

Permalink
Sanitizers (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexclique authored Apr 3, 2020
1 parent b5408dc commit 1edb490
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run Sanitizers

on:
push:
branches:
- master
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2020-03-08
override: true
- uses: davidB/rust-cargo-make@v1
with:
version: '0.30.0'
- name: Sanitizers
env:
RUST_BACKTRACE: full
RUST_LOG: 'trace'
run: |
tools/san_harness.sh
30 changes: 30 additions & 0 deletions tools/san_harness.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -eo pipefail

rustup update
rustup toolchain install nightly

if [[ "$OSTYPE" == "darwin"* ]]; then
TARGET_SELECT=''
else
TARGET_SELECT='x86_64-unknown-linux-gnu'
fi

# Run SANs
echo "LSAN"
cargo clean
export RUSTFLAGS="-Z sanitizer=leak"
cargo +nightly build --examples --target ${TARGET_SELECT}
sudo -E target/${TARGET_SELECT}/debug/examples/parallel_computation
sudo -E target/${TARGET_SELECT}/debug/examples/callbacks

# -------------------------------

echo "TSAN"
cargo clean
export RUSTFLAGS="-Z sanitizer=thread"
export TSAN_OPTIONS=suppressions=../../../../tools/tsan.suppressions
cargo +nightly build --examples --target ${TARGET_SELECT}
sudo -E target/${TARGET_SELECT}/debug/examples/parallel_computation
sudo -E target/${TARGET_SELECT}/debug/examples/send_recv
sudo -E target/${TARGET_SELECT}/debug/examples/callbacks
25 changes: 25 additions & 0 deletions tools/tsan.suppressions
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Anything comes from dynamic affinity pinner and load balancer of
# Bastion doesn't need concrete guarantees. They are not that crucial.
race:bastion_executor::blocking

# There is a bug for this. There is a dangling ref in the drop.
# Read more about it here: https://github.com/rust-lang/rust/issues/55005
race:Arc*drop
race:Condvar::*
race:std::sync::mpsc

# Races of drop for the Receiver guard
race:crossbeam_channel::counter::Receiver

# OpenSSL FFI
race:CRYPTO_THREAD*
race:OPENSSL_*

# Data races of mimalloc
race:mi*
race:_mi*

# lazy_static and thread_local has barriers which are not
# picked-up by TSAN. Like Lazy<T> and Local<T>.
race:lazy_static
race:std::thread::local

0 comments on commit 1edb490

Please sign in to comment.