From 93ad678df07c4da8c83dab0844b0bb5dde02b777 Mon Sep 17 00:00:00 2001 From: Boquan Fang Date: Tue, 10 Dec 2024 23:29:04 +0000 Subject: [PATCH 1/4] Add ASAN as a separate job in CI --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 468069eb7..308beefe9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -271,6 +271,31 @@ jobs: run: | ${{ matrix.target != 'native' && 'cross' || 'cargo' }} test --workspace ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} + asan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Install rust toolchain + id: toolchain + run: | + rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --component rust-src + rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }} + + - uses: camshaft/rust-cache@v1 + + - name: Run Unit Tests under ASAN + env: + RUSTDOCFLAGS: -Zsanitizer=address + RUSTFLAGS: -Zsanitizer=address + run: | + cargo test \ + -Zbuild-std \ + --workspace \ + --target x86_64-unknown-linux-gnu + fips: runs-on: ubuntu-latest steps: From e2f760c2f9559418079824472e42cf562251bc02 Mon Sep 17 00:00:00 2001 From: Boquan Fang Date: Tue, 10 Dec 2024 23:31:47 +0000 Subject: [PATCH 2/4] move workspace flag to the end --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 308beefe9..5ed98fa89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -293,8 +293,8 @@ jobs: run: | cargo test \ -Zbuild-std \ - --workspace \ - --target x86_64-unknown-linux-gnu + --target x86_64-unknown-linux-gnu \ + --workspace fips: runs-on: ubuntu-latest From 7b4cbd7ee14bc030d716ee9e89fe10840c65d976 Mon Sep 17 00:00:00 2001 From: Boquan Fang Date: Tue, 10 Dec 2024 23:41:10 +0000 Subject: [PATCH 3/4] Add symbolizer to the CI for ASAN --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ed98fa89..098382c3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -286,6 +286,16 @@ jobs: - uses: camshaft/rust-cache@v1 + # asan expects a binary at /usr/bin/llvm-symbolizer but GHA runners include + # multiple versioned binaries, like /usr/bin/llvm-symbolizer-13. This step + # finds the latest symbolizer and use it as the "base" llvm-symbolizer binary. + # + # llvm-symbolizer is necessary to get nice stack traces from asan errors. + # Otherwise the stack trace just contains a hex address like "0x55bc6a28a9b6" + - name: set llvm symbolizer + run: | + sudo ln -s $(find /usr/bin/ -maxdepth 1 -name "llvm-symbolizer-*" | sort -V | tail -n 1) /usr/bin/llvm-symbolizer + - name: Run Unit Tests under ASAN env: RUSTDOCFLAGS: -Zsanitizer=address From 0d311c2fa5d9176672820bd415c11b201e0ccbc9 Mon Sep 17 00:00:00 2001 From: Boquan Fang Date: Wed, 11 Dec 2024 00:11:27 +0000 Subject: [PATCH 4/4] Disable leak detection --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 098382c3a..b0a11d04f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -300,6 +300,9 @@ jobs: env: RUSTDOCFLAGS: -Zsanitizer=address RUSTFLAGS: -Zsanitizer=address + # We got a few globals that aren't cleaned up. Need to + # determine if we should reenable this in the future. + ASAN_OPTIONS: detect_leaks=false run: | cargo test \ -Zbuild-std \