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.
| Crate | lock_api |
|---|---|
| Type | Unsound (memory-corruption, thread-safety) |
| Affected versions | Before 0.4.2. |
| Fixed in | 0.4.2 |
| Severity | Medium (GitHub rating) |
| Published | 2020-11-08 |
| Last changed | 2024-03-15 |
| Also known as | CVE-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 functions | lock_api::MappedMutexGuard, lock_api::MappedRwLockReadGuard, lock_api::MappedRwLockWriteGuard, lock_api::RwLockReadGuard, lock_api::RwLockWriteGuard |
What to do
- See which version you have:
cargo tree -i lock_api(it also shows which of your dependencies pulls it in). - 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 examplelock_api = "0.4.2") or update the dependency that pulls it in. - 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
- Package: crates.io/crates/lock_api
- Advisory: rustsec.org/advisories/RUSTSEC-2020-0070.html
- Web: github.com/Amanieu/parking_lot/pull/262
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 →Also worth your time
Did this answer your question?