Email me

Rust advisories / spin

Vulnerability HighRUSTSEC-2019-0013 · spin

RUSTSEC-2019-0013: Wrong memory orderings in RwLock potentially violates mutual exclusion

Short answerA security vulnerability in the spin crate: Wrong memory orderings in RwLock potentially violates mutual exclusion. High severity (CVSS 7.5). Fixed in 0.5.2: update to a fixed version.

Cratespin
TypeVulnerability
Affected versionsBefore 0.5.2.
Fixed in0.5.2
SeverityHigh, CVSS 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Published2019-08-27
Last changed2023-11-08
Also known asCVE-2019-16137, GHSA-hv7x-f3pv-gpwr
Affected functionsspin::RwLock::new

What to do

  1. See which version you have: cargo tree -i spin (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p spin. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example spin = "0.5.2") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

Wrong memory orderings inside the RwLock implementation allow for two writers to acquire the lock at the same time. The drop implementation used Ordering::Relaxed, which allows the compiler or CPU to reorder a mutable access on the locked data after the lock has been yielded.

Only users of the RwLock implementation are affected. Users of Once (including users of lazy_static with the spin_no_std feature enabled) are NOT affected.

On strongly ordered CPU architectures like x86, the only real way that this would lead to a memory corruption is if the compiler reorders an access after the lock is yielded, which is possible but in practice unlikely. It is a more serious issue on weakly ordered architectures such as ARM which, except in the presence of certain instructions, allow the hardware to decide which accesses are seen at what times. Therefore on an ARM system it is likely that using the wrong memory ordering would result in a memory corruption, even if the compiler itself doesn't reorder the memory accesses in a buggy way.

The flaw was corrected by https://github.com/mvdnes/spin-rs/pull/66.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for spin

Full security history of spin

Up next

Same cratespin: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ