Rust advisories / cortex-m-rt
Unsound MediumRUSTSEC-2023-0014 · cortex-m-rt
RUSTSEC-2023-0014: Miscompilation in cortex-m-rt 0.7.1 and 0.7.2
Short answercortex-m-rt has an API that can cause undefined behaviour from safe code: Miscompilation in cortex-m-rt 0.7.1 and 0.7.2. Fixed in 0.7.3.
| Crate | cortex-m-rt |
|---|---|
| Type | Unsound |
| Affected versions | From 0.7.1 before 0.7.3. |
| Fixed in | 0.7.3 |
| Severity | Medium (GitHub rating) |
| Published | 2023-02-13 |
| Last changed | 2023-11-08 |
| Also known as | GHSA-xw5j-gv2g-mjm2 |
What to do
- See which version you have:
cargo tree -i cortex-m-rt(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p cortex-m-rt. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplecortex-m-rt = "0.7.3") 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
Version 0.7.1 of the cortex-m-rt crate introduced a regression causing the stack to NOT be eight-byte aligned prior to calling main (or any other specified entrypoint), violating the stack ABI of AAPCS32, the default ABI used by all Cortex-M targets. This regression is also present in version 0.7.2 of the cortex-m-rt crate.
This regression can cause certain compiler optimizations (which assume the eight-byte alignment) to produce incorrect behavior at runtime. This incorrect behavior has been observed in real-world applications.
**It is advised that ALL users of v0.7.1 and v0.7.2 of the cortex-m-rt crate update to the latest version (v0.7.3), AS SOON AS POSSIBLE.** Users of v0.7.0 and prior versions of cortex-m-rt are not affected by this regression.
It will be necessary to rebuild all affected firmware binaries, and flash or deploy the new firmware binaries to affected devices.
References
- Package: crates.io/crates/cortex-m-rt
- Advisory: rustsec.org/advisories/RUSTSEC-2023-0014.html
- Web: github.com/rust-embedded/cortex-m/discussions/469
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?