saulecabrera requested alexcrichton for a review on PR #14619.
saulecabrera requested wasmtime-compiler-reviewers for a review on PR #14619.
saulecabrera opened PR #14619 from saulecabrera:winch-issue-oob to bytecodealliance:main:
Closes: https://github.com/bytecodealliance/wasmtime/issues/14588
With
memory_may_movedisabled, Winch treatedmemory_reservationas an upper bound on accessible memory and turned any access whose offset + access size exceeded it into an unconditional trap. But when a memory's minimum size is larger than the reservation, the runtime sizes the allocation from the minimum instead, so in-bounds accesses past the reservation trapped spuriously.The static out-of-bounds check now applies the reservation only when the memory's minimum byte size fits within it; otherwise the access falls through to a regular dynamic bounds check.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
saulecabrera requested wasmtime-core-reviewers for a review on PR #14619.
saulecabrera edited PR #14619.
saulecabrera edited PR #14619.
github-actions[bot] added the label winch on PR #14619.
github-actions[bot] commented on PR #14619:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:memo: alexcrichton submitted PR review:
Would it make sense to perhaps just remove this clause entirely? I'm having a tough time reasoning about the precise condition here and if it works just deleting the clause related to memory-reservation outright seems like a possibly simpler approach
saulecabrera updated PR #14619.
saulecabrera edited PR #14619:
Closes: https://github.com/bytecodealliance/wasmtime/issues/14588
With
memory_may_movedisabled, Winch treatedmemory_reservationas an
upper bound on accessible memory and turned any access whose
offset + access size exceeded it into an unconditional trap. But when a
memory's minimum size is larger than the reservation, the runtime sizes
the allocation from the minimum instead, so in-bounds accesses past the
reservation trapped spuriously.This removes the reservation clause, leaving
maximum_byte_sizeas the
only compile-time out-of-bounds check, which matches Cranelift. Accesses
past the reservation now get the regular bounds check, which still traps
when the memory can't grow past the reservation.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
saulecabrera commented on PR #14619:
That makes sense to me @alexcrichton, I was not sure as well on the original motivation for this check (and admittedly took me a bit to wrap my head around it). I've removed it in https://github.com/bytecodealliance/wasmtime/pull/14619/commits/90d3cddd3de39f7c4841242226cc6c53c5d26cf3; decided to keep the run test since there was none covering this feature.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton added PR #14619 winch: Don't treat memory_reservation as a bound when minimum exceeds it to the merge queue.
:check: alexcrichton merged PR #14619.
alexcrichton removed PR #14619 winch: Don't treat memory_reservation as a bound when minimum exceeds it from the merge queue.
Last updated: Oct 11 2026 at 04:10 UTC