Skip to content

Inventory 0.1 is unsound (allows std access before init of Rust runtime) #1773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions crates/inventory/RUSTSEC-0000-0000.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```toml
[advisory]
id = "RUSTSEC-0000-0000"
package = "inventory"
date = "2023-09-10"
url = "https://github.com/dtolnay/inventory/pull/43"
informational = "unsound"
keywords = ["life-before-main"]

[versions]
patched = [">= 0.2.0"]
```

# Fails to prohibit standard library access prior to initialization of Rust standard library runtime

Affected versions allow arbitrary caller-provided code to execute before the
lifetime of `main`.

If the caller-provided code accesses particular pieces of the standard library
that require an initialized Rust runtime, such as `std::io` or `std::thread`,
these may not behave as documented. Panics are likely; UB is possible.

The flaw was corrected by enforcing that only code written within the
`inventory` crate, which is guaranteed not to access runtime-dependent parts of
the standard library, runs before `main`. Caller-provided code is restricted to
running at compile time.