← ClaudeAtlas

rust-sanitizers-mirilisted

Use when you run AddressSanitizer, ThreadSanitizer or MemorySanitizer on Rust code, when you run UBSan on a C or C++ dependency of a Rust crate, when you configure Miri to find undefined behaviour in unsafe Rust (Stacked Borrows or Tree Borrows), when you stub an FFI dependency that Miri cannot execute, when you enable HWASan on Android or MTE on Android 14+, when you enable ASan or TSan on iOS through Xcode, when you read a tombstone tagged SEGV_MTEAERR or SEGV_MTESERR, or when you wire any of these tools into CI. Triggers on "sanitizer", "miri", "ASan", "TSan", "MSan", "HWASan", "MTE", "undefined behavior", "stacked borrows", "tree borrows", or memory-safety validation questions.
po4yka/rust-skills · ★ 2 · AI & Automation · score 76
Install: claude install-skill po4yka/rust-skills
# Rust Sanitizers and Miri Runtime and interpreter-based safety validation for Rust: ASan, TSan and MSan through `RUSTFLAGS`; UBSan through the C compiler on a C or C++ dependency; Miri for undefined behaviour (UB) in unsafe code; HWASan and MTE for on-device Android validation; ASan and TSan for iOS; and the rules to read the reports that these tools produce. ## 1. Select the tool Select the tool from the bug class, not from habit. Each tool finds a different class and misses the others. | Bug class | Tool to use | Do not use | |---|---|---| | Aliasing rule breach, invalid value, provenance error | Miri | ASan (does not model Rust rules) | | Heap overflow, use-after-free, double free at runtime | ASan, HWASan or MTE | Miri, if the path reaches FFI | | Data race between threads | TSan, or Miri with `-Zmiri-seed` | ASan | | Read of uninitialized memory | MSan or Miri | ASan | | Integer overflow or null deref in a C or C++ dependency | UBSan, built with clang `-fsanitize=undefined` | Miri (does not execute C or C++), `RUSTFLAGS` (rustc has no UBSan option) | | UB inside a C or C++ dependency | ASan, HWASan or MTE | Miri (cannot interpret C or C++) | | Type or lifetime error | `cargo check --locked`, Clippy | any sanitizer | Full overhead and requirement comparison: `references/miri-ub-patterns.md`. Two rules follow from the table: - Miri sees Rust semantics but cannot execute foreign code. - Sanitizers execute foreign code but do not know the Rust aliasing model. Run bo