Files
extism/kernel
zach 4bd0ed6d03 feat: add ability to dump extism kernel memory and generate coredumps, cleanup kernel memory layout (#539)
Fixes https://github.com/extism/extism/issues/537

- Requires wasmtime 14.0.0 or greater for coredump serialization
- Adds `EXTISM_COREDUMP` environment variable to write wasmtime coredump
to a file when an error occurs
- This will create a coredump from the main wasm module, which means it
doesn't give us too much insight into the kernel
- Adds `EXTISM_MEMDUMP` environment variable to write extism linear
memory to a file when an error occurs
  - This gives us access to the kernel memory  
- Adds some missing profiling options
- Converts timeouts to a Trap instead of a plain error, this helps us
get better information about where the timeout occured
- Some small improvements to error handling after a plugin call
- Adds a test for coredump and memdump generation
- Adds the ability to configure debug options using `PluginBuilder`
- Fixes memory layout and a wasted page of memory in the kernel, found
while debugging a memory dump

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: zshipko <zshipko@users.noreply.github.com>
2023-10-24 17:31:26 -07:00
..
2023-10-10 16:15:18 -07:00

Extism kernel

The Extism kernel implements core parts of the Extism runtime in Rust compiled to WebAssembly. This code is a conceptual re-write of memory.rs with the goal of making core parts of the Extism implementation more portable across WebAssembly runtimes.

See lib.rs for more details about the implementation itself.

Building

Because this crate is built using the wasm32-unknown-unknown target, it is a separate build process from the extism-runtime crate.

To build extism-runtime.wasm, strip it and copy it to the proper location in the extism-runtime tree you can run:

$ sh build.sh