Stream: git-wasmtime

Topic: wasmtime / PR #7353 mpk: maintain mapping of pkey ID to s...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 24 2023 at 22:29):

abrown opened PR #7353 from abrown:pku-robust-mapping to bytecodealliance:main:

Previously, we assumed that the Wasmtime engine would be able to
allocate keys 1-15 from the OS, in that order. (Recall that Linux
reserves key 0 for itself). While enabling various tests for MPK,
tests in wasmtime_fuzzing::oracles would fail because Wasmtime could
only start allocating at key 2, e.g.; it turns out that the
diff_v8::smoke test instantiates V8 which happens to allocate a key
for itself.

The reason for the "allocate keys 1-15 in order" assumption was that the
logic for calculating the stripe each key owned was very simple: key - 1. We needed some way to map each key ID to the stripe ID it is
associated with.

With this change, we maintain a little bit more state in order to make
the mapping less brittle. ProtectionKey stores the "key ID to slice
ID" mapping as an additional u32 in the struct. This means that,
regardless of what other code in the process allocates MPK keys,
Wasmtime should be able to work fine with the remaining keys it can
allocate.

<!--
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 (Oct 24 2023 at 22:29):

abrown requested alexcrichton for a review on PR #7353.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 24 2023 at 22:29):

abrown requested wasmtime-core-reviewers for a review on PR #7353.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 24 2023 at 22:40):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 24 2023 at 22:47):

abrown has enabled auto merge for PR #7353.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 24 2023 at 23:48):

abrown merged PR #7353.


Last updated: Nov 22 2024 at 16:03 UTC