| bc6585e8 | 30-Mar-2026 |
Alex Crichton <[email protected]> |
Fix logic and double-drop UB in `WriteBuffer` impls (#12870)
For component-model-async this fixes logic and undefined behavior issues in the implementation of the `WriteBuffer` trait for various typ
Fix logic and double-drop UB in `WriteBuffer` impls (#12870)
For component-model-async this fixes logic and undefined behavior issues in the implementation of the `WriteBuffer` trait for various types. Notably all types didn't respect the `unsafe` contract of the `WriteBuffer::take` method by limiting the number of results to what was requested. This flawed detail, when coupled with other implementation details, led to both incorrect results and UB in the case that `VecBuffer<T>` was used where `T` had a `Drop` implementation. This is not a security issue because component-model-async is not yet Tier 1 and thus is exempt from the security issue process, but this is nonetheless something needed to be fixed.
show more ...
|
| 133a0ef4 | 13-Mar-2026 |
Chris Fallin <[email protected]> |
Debugging: add the debug-main world. (#12756)
* Debugging: add the debug-main world.
This PR "draws the rest of the owl" for the debug-main world (bytecodealliance/rfcs#45). This includes a WIT wor
Debugging: add the debug-main world. (#12756)
* Debugging: add the debug-main world.
This PR "draws the rest of the owl" for the debug-main world (bytecodealliance/rfcs#45). This includes a WIT world that hosts debug components that have access to "host debug powers" via a debugging API, and the ability to load such a debug-component and give it control of the main program as a debuggee when using `wasmtime run`.
The WIT is namespaced to `bytecodealliance:wasmtime` and is slightly aspirational in places: for example, the host does not yet implement injection of early return values or exception-throws. I intend to fill out a series of TODO issues once this all lands to track followup ("post-MVP") work.
This PR does not include any debug components. I separately have a gdbstub component, with which I tested and co-developed this host-side implementation. My plan is to land it in a followup PR as a component that will be embedded in/shipped with the Wasmtime CLI and available under an easy-to-use CLI option. Once we have that gdbstub component, we can also implement end-to-end integration tests that boot up LLDB and run through an expected interaction. (Separately, those integration tests will require a release of wasi-sdk to ship an LLDB binary that we can use.) As such, there are no real tests in this PR: interesting behaviors only really occur with a full end-to-end flow.
The integration with the CLI is a little awkward (we internally build another `wasmtime run` command that invokes the debug component, and tie it together with the debuggee via a special `invoke_debugger` API; this seemed less bad than reworking all of the WASI setup to be more reusable). Happy to take more ideas here.
* Review feedback.
* Review feedback.
* Review feedback: update vendor-wit.sh.
* Review feedback: -Ddebugger-arg= -> -Darg=.
* Review feedback.
* Review feedback.
* Review feedback: factor host.rs into several submodules.
* Review feedback: rename Debugger to Debuggee on host side.
* Review feedback: split inherit_stdin_stdout, and add corresponding options for the debug component.
* Review feedback.
* Review feedback.
* Add simple debug-component tests.
* Add wasm32-wasip2 target in a few places in CI
* Cargo vets for wstd dependency.
* Add wasm32-wasip2 in more places
* fix debug-component test dependence on componentization byte offsets
* Review feedback.
* Fix cancel-safety of EventFuture.
* Fix: Interrupted events should only occur after interrupt(), not on every epoch yield.
* Review feedback.
* Review feedback: strip down WASI imports in debugger world.
* fold debugger test component back into wasip1 + adapter test artifact compilation flow
show more ...
|
| daee7fda | 21-Jan-2026 |
Nick Fitzgerald <[email protected]> |
Introduce `wasmtime_environ::collections::{OomArc, OomBox}` (#12361)
* Introduce `wasmtime_environ::collections::{OomArc, OomBox}`
These types mirror their `std`/`alloc` counterparts, but only prov
Introduce `wasmtime_environ::collections::{OomArc, OomBox}` (#12361)
* Introduce `wasmtime_environ::collections::{OomArc, OomBox}`
These types mirror their `std`/`alloc` counterparts, but only provide fallible constructors and properly handle OOM by returning `Err(OutOfMemory)`.
Note that stable Rust doesn't actually give us any method to build fallible allocation for `Arc<T>`, and we do not wish to fork `Arc<T>` since it is full of very subtle unsafe code, so `OomArc::new` is only actually fallible in practice when using nightly Rust and setting `RUSTFLAGS="--cfg arc_try_new"` during the build. We use a custom `cfg`, rather than a cargo feature, so that `cargo test --all-features --workspace` (which is morally what CI does) continues to Just Work in the workspace, same as we do for e.g. Pulley's usage of the nightly Rust tail calls feature.
Part of https://github.com/bytecodealliance/wasmtime/issues/12069
* Avoid unused import warning in certain build configs
* Remove `out_of_line_slow_path!` macro
* Use extension traits for fallible `Arc<T>` and `Box<T>` allocation
Instead of defining new wrapper types around them.
* Fix example in docs
show more ...
|