Email me

Rust advisories / lock_api

Unsound MediumRUSTSEC-2020-0070 · lock_api

RUSTSEC-2020-0070: Some lock_api lock guard objects can cause data races

Short answerlock_api has an API that can cause undefined behaviour from safe code: Some lock_api lock guard objects can cause data races. Fixed in 0.4.2.

Cratelock_api
TypeUnsound (memory-corruption, thread-safety)
Affected versionsBefore 0.4.2.
Fixed in0.4.2
SeverityMedium (GitHub rating)
Published2020-11-08
Last changed2024-03-15
Also known asCVE-2020-35910, CVE-2020-35911, CVE-2020-35912, CVE-2020-35913, CVE-2020-35914, GHSA-5wg8-7c9q-794v, GHSA-gmv4-vmx3-x9f3, GHSA-hj9h-wrgg-hgmx, GHSA-ppj3-7jw3-8vc4, GHSA-vh4p-6j7g-f4j9
Affected functionslock_api::MappedMutexGuard, lock_api::MappedRwLockReadGuard, lock_api::MappedRwLockWriteGuard, lock_api::RwLockReadGuard, lock_api::RwLockWriteGuard

What to do

  1. See which version you have: cargo tree -i lock_api (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p lock_api. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example lock_api = "0.4.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

Affected versions of lock_api had unsound implementations of the Send or Sync traits for some guard objects, namely:

  • MappedMutexGuard
  • MappedRwLockReadGuard
  • MappedRwLockWriteGuard
  • RwLockReadGuard
  • RwLockWriteGuard

These guards could allow data races through types that are not safe to Send across thread boundaries in safe Rust code.

This issue was fixed by changing the trait bounds on the Mapped guard types and removing the Sync trait for the RwLock guards.

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.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.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