Stream: git-wasmtime

Topic: wasmtime / issue #6004 Allow to easily disable clocks in ...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 13 2023 at 16:28):

RReverser opened issue #6004:

Feature

Allow to easily disable clocks when constructing a WasiCtx.

Benefit

This is useful for execution in deterministic environments where modules aren't allowed access to any non-deterministic sources, such as random data generation or system time.

Disabling random data generation (or, rather, substituting with pre-seeded source) is already easy in wasmtime, but it seems that the only ways to disable clocks is to either return a 0 time from clocks, which is not ideal compared to an explicit capability error, or to reimplement the entire WasiSnapshotPreview1 myself by forwarding everything except clock functions to the inner implementation, which is also pretty cumbersome.

Implementation

I'd probably wrap system and monotonic fields in WasiClocks into Option<...>.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 13 2023 at 16:58):

pchickey commented on issue #6004:

The requirements and implementation step sound good to me. I don't think any of our team has spare bandwidth to work on this right now but we'd be be happy to accept a PR.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 13 2023 at 16:58):

pchickey edited a comment on issue #6004:

The requirements and implementation idea sound good to me. I don't think any of our team has spare bandwidth to work on this right now but we'd be be happy to accept a PR.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 13 2023 at 19:33):

RReverser commented on issue #6004:

Thanks for the quick feedback. Sounds good, working on it.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 14 2023 at 00:25):

pchickey closed issue #6004:

Feature

Allow to easily disable clocks when constructing a WasiCtx.

Benefit

This is useful for execution in deterministic environments where modules aren't allowed access to any non-deterministic sources, such as random data generation or system time.

Disabling random data generation (or, rather, substituting with pre-seeded source) is already easy in wasmtime, but it seems that the only ways to disable clocks is to either return a 0 time from clocks, which is not ideal compared to an explicit capability error, or to reimplement the entire WasiSnapshotPreview1 myself by forwarding everything except clock functions to the inner implementation, which is also pretty cumbersome.

Implementation

I'd probably wrap system and monotonic fields in WasiClocks into Option<...>.


Last updated: Oct 23 2024 at 20:03 UTC