Stream: git-wasmtime

Topic: wasmtime / PR #14835 Validate map pointer/length before a...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:18):

jrandolf opened PR #14835 from jrandolf:map-lift-validate-before-alloc to bytecodealliance:main:

Lifting a map<K, V> into a HashMap reserved capacity for the guest-supplied length before checking that the entries actually fit in linear memory. This moves the allocation after the bounds, alignment and fuel checks, the same order lists use.

For reference, before this change a guest with a single page of memory returning (ptr = 0, len = u32::MAX) for a map<u32, u32> made the host's peak RSS jump by about 8 GiB (hashbrown initializes its control bytes) before the call failed with the bounds error. The added test checks for that error; I couldn't find a non-flaky way to assert on the allocation itself, but I'm happy to add one if there's a preferred pattern.

Closes #14810

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:24):

jrandolf has marked PR #14835 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:24):

jrandolf removed the review request for wasmtime-core-reviewers from PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:24):

jrandolf requested wasmtime-core-reviewers for a review on PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 19:24):

jrandolf requested pchickey for a review on PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 21:44):

github-actions[bot] added the label wasmtime:api on PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 16:30):

:memo: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 16:30):

:speech_balloon: alexcrichton created PR review comment:

I don't think this test is actually testing anything -- this passes before the change right?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 16:30):

:speech_balloon: alexcrichton created PR review comment:

It's ok to drop this comment, this is more of a commentary on "code as it was" which is irrelevant when this PR lands

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 16:30):

alexcrichton removed the review request for pchickey from PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 18:53):

jrandolf updated PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 18:58):

:memo: jrandolf submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 18:58):

:speech_balloon: jrandolf created PR review comment:

Yes, removed.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 18:58):

:memo: jrandolf submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 18:58):

:speech_balloon: jrandolf created PR review comment:

Done

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 18:58):

jrandolf edited PR #14835:

Lifting a map<K, V> into a HashMap reserved capacity for the guest-supplied length before checking that the entries actually fit in linear memory. This moves the allocation after the bounds, alignment and fuel checks, the same order lists use.

For reference, before this change a guest with a single page of memory returning (ptr = 0, len = u32::MAX) for a map<u32, u32> made the host's peak RSS jump by about 8 GiB (hashbrown initializes its control bytes) before the call failed with the bounds error. The call failed with the bounds error both before and after this change, so there's no test here; the allocation itself isn't observable from the test suite.

Closes #14810

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 19:04):

jrandolf requested alexcrichton for a review on PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 19:58):

:thumbs_up: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 19:58):

alexcrichton added PR #14835 Validate map pointer/length before allocating when lifting to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 20:24):

:check: alexcrichton merged PR #14835.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 20:24):

alexcrichton removed PR #14835 Validate map pointer/length before allocating when lifting from the merge queue.


Last updated: Oct 31 2026 at 23:03 UTC