bytecodealliance / lucet

Lucet, the Sandboxing WebAssembly Compiler.
Apache License 2.0
4.06k stars 165 forks source link

🈵 Add an option to terminate the runtime when `memory.grow` fails #583

Closed acfoltzer closed 4 years ago

acfoltzer commented 4 years ago

This new option determines whether to terminate the guest with a new TerminationDetails::HeapOutOfMemory variant when memory.grow fails, rather than returning -1. It is disabled by default, but can be set via InstanceBuilder or directly on the Instance.

This behavior deviates from the WebAssembly spec, but is useful in practice for determining when guest programs fail due to an exhausted heap.

Most languages will compile to code that includes an unreachable instruction if allocation fails, but this same instruction might also appear when other types of assertions fail, panic!() is called, etc. Terminating allows the error to be more directly identifiable.

acfoltzer commented 4 years ago

Blocking this pending #584