Commit dfdd653
authored
Introduce an OOM-handling
* Introduce an OOM-handling `Error` type for Wasmtime
This new `Error` has an API that is 99% identical to `anyhow::Error`'s API, but
additionally handles memory exhaustion.
This commit only introduces the `wasmtime_internal_error` crate into our
workspace, along with its regular tests and OOM tests. This commit does not,
however, migrate Wasmtime's internals or public-facing API over to the new error
type yet. That is left for follow up work.
In order to continue fitting `Result<(), Error>` in one word, there is quite a
bit of unsafe code in `Error`'s implementation, mostly surrounding the manual
creation of our own moral equivalent of `Box<dyn Error>` with explicit vtables
and type erasure so that we get a thin pointer to a trait object rather than
`Box<dyn Error>`'s fat pointer. To alleviate the associated risks, I've been
testing this code under MIRI throughout its whole development, as well as
thoroughly testing the API so that MIRI can dynamically exercise all the code
paths. Furthermore, I've enabled testing this crate under MIRI in CI.
* Fill out more cargo.toml info
* Add cargo vet entries for new crate
* Use single quotes for string in Cargo.toml to work around publish script bug
See #12164
* Add the `wasmtime_error::Ok` function
For compatibility with `anyhow`'s API.
This unfortunately means we have to move the actual error implementation out
into a submodule so that this function isn't visible, or else every `match .. {
Ok(_) => ... }` stops type checking.
* fix some stuff that was broken in the move to a module
* maybe fix cargo vet?
* Add comments about backtraces and OOM
* Debug assert `ConcreteError<E>` and `DynError` layouts are compatible for all `ConcreteError<E>`s that we actually allocate
* Add reference to layout test and assertions to docs about compatible layout requirements
* Use `#[track_caller]` to hide internal frame from error's backtrace
* Fix typo
* Pull various internal `ErrorExt` implementations out to top level
* Switch to `0x1` as the representation of OOM in `OomOrDynError` packing
* add audit-as-crates-io for wasmtime-internal-errorError type for Wasmtime (#12163)1 parent bb0ebb7 commit dfdd653
File tree
19 files changed
+3977
-8
lines changed- .github/workflows
- crates
- error
- src
- tests
- fuzzing
- src
- tests
- scripts
- supply-chain
19 files changed
+3977
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1144 | 1144 | | |
1145 | 1145 | | |
1146 | 1146 | | |
| 1147 | + | |
| 1148 | + | |
1147 | 1149 | | |
1148 | 1150 | | |
1149 | 1151 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments