Memory Protection for WASM

See README.md for details.

Demo

Pick a scenario: . (Enable instrumentation:) We'll rewrite the site of each load and store instruction to first call memory_protection.check to validate the adddress, byte length, and access type of each memory transaction. This function can be implemented with arbitrary JavaScript, but in this demo it calls into an auxiliary WASM module to efficiently implement mprotect-style access control based on permission bits in a giant table.

Diff of WAT

Result of execution