rust-sanitizers-miri

Detect undefined behavior in Rust with Miri and sanitizers.

58|4|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/po4yka/RIPDPI --skill rust-sanitizers-miri-po4yka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-sanitizers-miri
Source: https://github.com/po4yka/RIPDPI/tree/main/.claude/skills/rust-sanitizers-miri
Command: npx skills add https://github.com/po4yka/RIPDPI --skill rust-sanitizers-miri-po4yka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Rust safety validation is essential to catch undefined behavior, use-after-free, and memory-safety issues in unsafe Rust and FFI code; this skill provides a guided approach using Miri, sanitizers, and Android-specific tools to improve reliability.

Core Features & Use Cases

  • Runtime UB detection with Miri for unsafe Rust blocks and FFI boundaries
  • On-device sanitizers support (ASan/TSan/MSan) via Rust toolchains for CI and local testing
  • FFI stubbing guidance to safely test JNI and native bindings under Miri without crashing
  • CI integration templates and MIRIFLAGS/RUSTFLAGS config guidance for repeatable validation
  • Documentation on MTE/HWASan usage for Android and safe production builds

Quick Start

Install nightly Rust, enable Miri, and run cargo +nightly miri test to verify undefined behavior in unsafe Rust.

Frequently Asked Questions about rust-sanitizers-miri

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect undefined behavior in unsafe Rust and FFI code?

Detect undefined behavior in unsafe Rust by running Miri to identify memory-safety issues like use-after-free at FFI boundaries. Applying Miri to unsafe blocks and native bindings catches runtime violations standard compilation misses.

What's the best way to test JNI bindings under Miri without crashing?

The best way to test JNI bindings under Miri is to implement FFI stubs that safely simulate native code interactions. This prevents crashes by isolating Rust safety validation from external C dependencies during execution.

Can I use Miri to validate Android builds requiring HWASan or MTE verification?

Yes, you can validate Android builds by combining Miri for undefined behavior detection with HWASan or MTE configurations. This provides documentation on applying on-device sanitizers for safe production builds on Android targets.

How do I configure MIRIFLAGS and RUSTFLAGS for sanitizer CI integration?

Configure MIRIFLAGS and RUSTFLAGS by setting environment variables in your CI templates to enable ASan, TSan, and MSan via Rust toolchains. This establishes repeatable validation pipelines for local testing and automated checks.

Does Miri work with all Rust projects or only those with unsafe blocks?

Miri works across Rust projects but is essential for those with unsafe blocks and FFI integrations. It specifically targets safety gaps in native bindings and JNI code where undefined behavior and memory issues are most likely.

Why does Miri fail on FFI calls and what are the limitations?

Miri fails on direct FFI calls because it cannot execute external native code, requiring FFI stubs to bypass this limitation. Users must mock C library interactions to complete Rust safety validation without aborting.