Run cargo careful and sanitizers in CI - #20
Merged
Merged
Conversation
Miri cannot run shimforge, because it rewrites machine code at run time. These jobs check the unsafe code while the real patching runs instead, with the tools crossbeam uses for the same purpose: - cargo careful on Linux, Windows and macOS, which rebuilds std with debug assertions and runs with -Z randomize-layout. - AddressSanitizer and ThreadSanitizer on x86_64 Linux, through the x86_64-unknown-linux-gnuasan and gnutsan targets; ThreadSanitizer rebuilds std with -Z build-std. Each job runs the shimforge test suite with one test thread, then tests/parallel.rs with eight. Builds stay unoptimized, unlike crossbeam's, because shimforge needs opt-level 0. A trial on nightly-2026-08-15 found no memory errors, data races or failed std preconditions. It needed three adjustments, all applied here: - LeakSanitizer reports the route entry that routing::install_replacement keeps on purpose after a failed patch write. One unit test injects that failure, and scripts/lsan-suppressions.txt suppresses leaks from that test only. The job finds llvm-symbolizer so the suppression can match. - cargo careful cannot start the shimforge-macros test binary, which links std dynamically, so the job tests the shimforge package only. - Nightlies since 2026-08-22 use the next-generation trait solver, which rejects the current mock! signature check. The jobs pin nightly-2026-09-12 and pass -Znext-solver=coherence until that check is changed. The jobs are not required checks yet; that can only be set once this workflow is on main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds CI jobs that look for undefined behaviour while the real patching runs. Miri cannot run shimforge.
cargo carefulon Linux, Windows and macOSNotes:
scripts/lsan-suppressions.txtignores that leak only.cargo carefulskips the macros crate, because it cannot start that test binary.-Znext-solver=coherencefor now. It can be removed after Check borrowed inputs on the declared signature #19.Trial run: https://github.com/XTSoftwareLabs/shimforge/actions/runs/34746405672