Stream: git-wasmtime

Topic: wasmtime / PR #8758 Make module ids unique per-process, n...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 18:32):

alexcrichton opened PR #8758 from alexcrichton:make-module-id-globally-unique to bytecodealliance:main:

Currently all instances of wasmtime::Module have a unique 64-bit id embedded into them. This ID was originally only used for affinity in the pooling allocator as a quick check of module equality. This use case only required engine-local ids so the initial implementation had an ID allocator per-engine.

Later, however, this id was reused for wasmtime::ModuleExport which was intended to skip the string lookup for an export at runtime. This also stored a module id but it did not store an engine identifier. This meant that it's possible to mix these up and pass the wrong export to the wrong engine. This behavior can lead to a runtime panic in Wasmtime.

This commit fixes this by making the module identifier be global per-process instead of per-engine. This mirrors how store IDs are allocated where they're per-process instead of per-engine. The same logic for why store IDs are unlikely to be exhausted applies here too where this 64-bit space of identifiers is unlikely to be exhausted.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 18:32):

alexcrichton requested fitzgen for a review on PR #8758.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 18:32):

alexcrichton requested wasmtime-core-reviewers for a review on PR #8758.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 18:57):

pchickey submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 21:56):

alexcrichton updated PR #8758.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 21:56):

alexcrichton has enabled auto merge for PR #8758.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 22:16):

alexcrichton updated PR #8758.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 07 2024 at 22:39):

alexcrichton merged PR #8758.


Last updated: Nov 22 2024 at 17:03 UTC