Commit Graph

10 Commits

Author SHA1 Message Date
zach
18b01b5d16 fix: undo change to extism_memory_bytes left over from debugging (#519)
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-16 17:48:44 -07:00
zach
c893faede4 fix(kernel): update outdated implementation of MemoryBlock::next_ptr (#509)
`MemoryBlock::next_ptr` used to calculate the offset to the data of the
next block, but it should be returning the start of the `MemoryBlock`
structure in memory. Also updates the tests for this case.

This was discovered when trying to update the kernel in the go-sdk:
https://github.com/extism/go-sdk/pull/32

---------

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-12 17:57:50 -07:00
zach
6f4b43bedc feat: add benchmarking, optimize bounds checking in the kernel (#505)
- Adds benchmarking, run with `cargo bench` or `cargo criterion`
- Adds `MemoryRoot::pointer_in_bounds_fast` to do less precise bounds
checking in loads/stores

---------

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-12 13:24:34 -07:00
zach
64fd246b73 feat: kernel hardening (#499)
- Kernel-specific tests
- Add bounds checking to the kernel, which can toggled using the
`bounds-checking` feature
- Next week I will do some benchmarking to determine the runtime
performance impact of bounds checking and can consider if it should be
relaxed for certain operations (mainly stores/loads)

---------

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-10 16:15:18 -07:00
zach
6e8c28b0e9 fix(main): improve the way the kernel calculates how many pages to allocate (#472)
Same as #471 for `main` branch

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: zshipko <zshipko@users.noreply.github.com>
2023-09-20 16:25:48 -07:00
zach
28074af2b9 ci: automate PRs to build canonical version of extism-runtime.wasm (#473)
Closes #469 

This PR adds a github workflow that is triggered by updates to the
`kernel/` directory or `runtime/src/extism-kernel.wasm` - it builds the
kernel, including using `wasm-strip` and makes a PR against any PR that
has a kernel module that doesn't match the expected output.

I had considered making this run when the PR is merged into main, but
this approach gives us a chance to run CI with the generated wasm file.
I think automatically adding a commit would be simpler, but this way
seems more transparent.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: zshipko <zshipko@users.noreply.github.com>
2023-09-20 15:21:42 -07:00
zach
016e9158ef fix(main): Fixes rounding issue in kernel num_pages (#468)
This is #466 for the `main` branch

Co-authored-by: Benjamin Eckel <bhelx@simst.im>
2023-09-18 17:38:38 -07:00
zach
d040c8b8a8 fix(kernel): avoid allocating 0-length blocks (#465)
Fixes an issue where the kernel was able to allocate empty blocks,
causing some weird memory issues.
2023-09-18 11:23:36 -07:00
zach
6a15884963 fix: remove call to bash from build.rs (#429)
I think this will fix the issue with CI hanging - this fixes the issue
when building Elixir, which seems to be the same as the CI issue
2023-08-23 19:12:51 -05:00
zach
3da526286e feat: Implement parts of the extism runtime in WebAssembly (#384)
This PR adds the `kernel` directory which contains a port of the Extism
memory allocator compiled to WebAssembly and removes
`runtime/src/memory.rs` completely.

Being able to re-use memory functions as a WASM module allows us to
begin to experiment with porting Extism to new runtimes!

This is in a draft state while I'm verifying some of these changes.
2023-07-27 11:31:23 -07:00