sb-dev/openquant / .agents/skills/rust-review
rust-review
VerifiedReview Rust crates, services, or libraries for safe/unsafe boundary issues, memory safety, concurrency hazards, panic-induced denial of service, FFI safety, and async runtime mistakes. Use for a Rust security audit, especially unsafe, FFI, or concurrent code.
upstream/prompts/general/atomic-race-finder.md
View on GitHub---
name: atomic-race-finder
description: Detects non-atomic read-modify-write sequences on Atomic* types
---
**Finding ID Prefix:** `ATOMICRACE`.
**Bug shape:** `let v = a.load(Ordering::Acquire); if v == X { a.store(Y, Ordering::Release); }` — two independent ops; another thread can race between them.
**Gates:**
1. `Atomic*.load(...)` followed by conditional `Atomic*.store(...)` on the same variable, where the store is dependent on the load.
2. No `compare_exchange` / `compare_exchange_weak` / `fetch_update` in between.
3. The Atomic is shared (`Arc<Atomic*>`, `static`, or field of `Arc<...>`).
**FPs (reject):**
- Single-writer atomic: only one thread ever `store`s (others only `load`), so the load→store pair is never concurrent with another writer.
- The load/store pair sits inside a held `Mutex`/`RwLock` critical section — the lock, not the atomic, supplies atomicity (if the locking itself is wrong, that is `DLOCK`).
- An existing `compare_exchange` / `compare_exchange_weak` / `fetch_update` already performs the update atomically (gate 2 already excludes these — reconfirm before filing).
**Patch:** convert to `compare_exchange` loop or `fetch_update`.
**Search patterns:**
```
\.load\s*\(
\.store\s*\(
\.(compare_exchange(_weak)?|fetch_update)\s*\(
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |