Migrate the min-platform example to `wasmtime::error` (#12267)
docs: minor improvement for docs (#11952)Signed-off-by: geogrego <[email protected]>
Disallow loading code on `x86_64-unknown-none` (#11553)* Disallow loading code on `x86_64-unknown-none`... And then also add an escape hatch to allow loading code. This commitis the culmination
Disallow loading code on `x86_64-unknown-none` (#11553)* Disallow loading code on `x86_64-unknown-none`... And then also add an escape hatch to allow loading code. This commitis the culmination of discussion on #11506 with a proposed resolutionfor Wasmtime. The resolution being:* Wasmtime will reject loading code on `x86_64-unknown-none` platforms by default.* A new `Config::x86_float_abi_ok` escape hatch is added to bypass this check.* Documentation/errors are updated around `x86_float_abi_ok` to document the situation.* The `min-platform` example is updated to showcase how this is valid to run in that particular embedding (aka enable more features and sufficiently detect said features).The basic tl;dr; is that we can't detect in stable Rust what float ABIis being used so therefore we pessimistically assume that`x86_64-unknown-none` is using a soft-float ABI. This is incompatiblewith libcalls unless they aren't actually called which is only possiblewhen sufficiently many target features are enabled.The goal of this commit is to be a relatively low-effort way to place aroadblock in the way of "ok ABIs are weird" but at the same time enablegetting around the roadblock easily. Additionally the roadblock pointsto documentation about itself to learn more about what's going on here.Closes #11506* Add audit of raw-cpuid* Add back in checkTurns out it doesn't go through the same path as other bits* Review comments* Fix running floats without without custom support
show more ...
Get the min-platform example working again (#11516)A few various changes have happened in the meantime which means thatthis wasn't actually testing anything on CI. Notably these changes weremade:
Get the min-platform example working again (#11516)A few various changes have happened in the meantime which means thatthis wasn't actually testing anything on CI. Notably these changes weremade:* Sink icache maintenance into `vm::sys` modules. This is fallout of #11152 where no_std support was added for unix/windows targets. This commit moves the error-on-lack-of-std to the `unix` and `windows` modules, relegating the custom module to figure its own pieces out as necessary. This also feels like a more accurate reflection of how responsibilities should be sliced up.* The example runner now uses `bail!` to return an error in case something bad happens instead of continuing as usual and pretending nothing bad happened.
Update Wasmtime to the 2024 Rust Edition (#10806)* Update Wasmtime to the 2024 Rust EditionNow that our MSRV supports the 2024 edition it's possible to make thisswitch. This commit moves Wasmtim
Update Wasmtime to the 2024 Rust Edition (#10806)* Update Wasmtime to the 2024 Rust EditionNow that our MSRV supports the 2024 edition it's possible to make thisswitch. This commit moves Wasmtime to the 2024 Edition to keepup-to-date with Rust idioms and access many of the edition featuresexclusive to the 2024 edition.prtest:full* Reformat with the 2024 edition
add wasmtime-wasi-io and custom async executor to min-platform example (#10128)* add wasmtime-wasi-io and custom async executor to min-platform example* make it possible to find example from wasm
add wasmtime-wasi-io and custom async executor to min-platform example (#10128)* add wasmtime-wasi-io and custom async executor to min-platform example* make it possible to find example from wasmtime-wasi-io docsprtest:full* fix comment* add wasm32-wasip2 target for min-platform ciand enable signals based traps when running with wasi disabled,because at the moment without signals based traps no native code can beloaded so the embedding never actually executes wasm. this ensures theheap size setting when not(feature = "wasi") is checked by execution* fix cbindgen version in ci
Replace `signals-based-traps` with auto-detection (#9941)* Replace `signals-based-traps` with auto-detectionThis commit refactors the platform support of the `wasmtime` crateitself to remove the
Replace `signals-based-traps` with auto-detection (#9941)* Replace `signals-based-traps` with auto-detectionThis commit refactors the platform support of the `wasmtime` crateitself to remove the previously added `signals-based-traps` feature infavor of auto-detecting whether it's there or not. The `build.rs`script for the `wasmtime` crate will now detect the target platform andauto-enable this feature as necessary.The `signals-based-traps` cargo feature is removed and split into twocustom `#[cfg]` directives that the build script sets:* `has_virtual_memory` - this is used to gate mmap implementations for example. This is enabled on `unix || windows` and will be off for `no_std` targets for example. This is split out of "signals-based-traps" to better handle platforms like iOS which have virtual memory but don't execute native code (removing the need for native signals).* `has_native_signals` - gates signal handlers on Unix for example. This is disabled on MIRI but otherwise enabled for `unix || windows`. This is intended to in the future get disabled for iOS by default for example since it's not necessary when using Pulley. This is additionally off-by-default for `no_std` platforms.Two new crate features were added for `no_std` or "custom" platforms toopt-in to the `wasmtime-platform.h` C APIs for implementing virtualmemory and signals. These are used in the `min-platform` embedding example.This commit additionally updates some various documentation here andthere to be more up-to-date.* Update CI configuration* Fix compile warnings* Fix test on miri* Fix more tests on miri* Fix some warnings* Another round of miri/CI attempts/fixesprtest:full
Add a `signals-based-traps` Cargo compile-time feature (#9614)* Gate signal handlers behind a new Cargo featureThis commit adds a new on-by-default Cargo feature to the `wasmtime`crate named `si
Add a `signals-based-traps` Cargo compile-time feature (#9614)* Gate signal handlers behind a new Cargo featureThis commit adds a new on-by-default Cargo feature to the `wasmtime`crate named `signals-based-traps`. This is modeled after the`Config::signals_based_traps` configuration at runtime and can be usedto statically disable the use of signal handlers in Wasmtime. Thisnotably reduces the number of platform dependencies that Wasmtime hasand provides a mode of avoiding relying on signals altogether.This introduces a new `MallocMemory` which is a linear memory backed bythe system allocator. This new type of memory is enabled when virtualmemory guards are disabled and signals-based-traps are disabled. Thismeans that this new type of memory will be candidate for fuzzing forexample.prtest:full* Fix rebase conflict* Refactor `MmapVec` documentation and representation* Remove no-longer-needed `Arc`* Document it may be backed by `Vec<u8>`
Update object to 0.36 (#8733)* Update object to 0.36* Update exemptions for the `object` crate---------Co-authored-by: Alex Crichton <[email protected]>
Make the min-platform build script work when run from other directories (#8584)Annoying to have to `cd` to the directory first before running the buildscripts.
Update documentation and example for no_std (#8555)* Update Wasmtime's tier stability documentationMove some items between tiers and add a few misc items here and there.* Update platform suppor
Update documentation and example for no_std (#8555)* Update Wasmtime's tier stability documentationMove some items between tiers and add a few misc items here and there.* Update platform support documentationRe-word lots of this since it was originally written, link to the tiersof support page, and rewrite the section on `no_std`.* Update the `min-platform` example with no_stdThis commit updates the preexisting `min-platform` example to no longerrequire Nightly Rust and instead use the `no_std` support now added toWasmtime. This involved:* Change the build process to produce a staticlib which is then manually converted via `cc` into a shared library for the native Linux platform.* Compile the modules outside of the embedding and only `deserialize` within the embedding.* Update the `indexmap` dependency to pick up a bug fix required in `no_std` mode (apparently, it fails on [email protected] and passes at 2.2.6, I didn't dig much further).This commit additionally makes the `wasmtime-platform.h` header filegenerated by the example a release artifact for Wasmtime itself. Theheader itself is touched up a bit by configuring some more `cbindgen`options as well.* Fix clippy buildprtest:full* Review comments* Pass gc-sections to linking the library
Turn the `wasmtime-runtime` crate into the `wasmtime::runtime::vm` module (#8501)* Expose `wasmtime-runtime` as `crate::runtime::vm` internally for the `wasmtime` crate* Rewrite uses of `wasmtime
Turn the `wasmtime-runtime` crate into the `wasmtime::runtime::vm` module (#8501)* Expose `wasmtime-runtime` as `crate::runtime::vm` internally for the `wasmtime` crate* Rewrite uses of `wasmtime_runtime` to `crate::runtime::vm`* Remove dep on `wasmtime-runtime` from `wasmtime-cli`* Move the `wasmtime-runtime` crate into the `wasmtime::runtime::vm` module* Update labeler for merged crates* Fix `publish verify`prtest:full
Add a "custom" platform configuration for Wasmtime (#7995)* Add a "custom" platform configuration for WasmtimeThis commit leverages adds a new "platform" to Wasmtime to be supportedin the `crate
Add a "custom" platform configuration for Wasmtime (#7995)* Add a "custom" platform configuration for WasmtimeThis commit leverages adds a new "platform" to Wasmtime to be supportedin the `crates/runtime/src/sys` folder. This joins preexisting platformssuch as Unix and Windows. The goal of this platform is to be an opt-inway to build Wasmtime for targets that don't have a predefined way torun.The new "custom" platform requires `--cfg wasmtime_custom_platform` tobe passed to the Rust compiler, for example by using `RUSTFLAGS`. Thisnew platform bottoms out in a C API that is intended to be small andLinux-like. The C API is effectively the interface to virtual memorythat Wasmtime requires. This C API is also available as a header file at`examples/min-platform/embedding/wasmtime-platform.h` (generated by`cbindgen`).The main purpose of this is to make it easier to experiment with portingWasmtime to new platforms. By decoupling a platform implementation fromWasmtime itself it should be possible to run these experimentsout-of-tree. An example of this I've been working on is gettingWasmtime running on bare-metal with a custom kernel. This supportenables defining the platform interface of the custom kernel's syscallsoutside of Wasmtime.* Exclude wasmtime-platform.h from formatting* Include build-wasmtime-target-wasm32 in final job* Don't force any single toolchain* Add notes to no_std docs* Add rust-src to CI* Review comments* Change APIs to be fallible* Only compile the min-platform example on Linux* Fix compile of min-platform example* Fix another compile error in the example