Repository navigation
winch: Don't treat memory_reservation as a bound when minimum exceeds it - #14619
Merged
Merged
Conversation
saulecabrera
requested review from
alexcrichton
and removed request for
a team
October 8, 2026 23:49
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
alexcrichton
reviewed
Oct 9, 2026
alexcrichton
left a comment
Member
There was a problem hiding this comment.
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
…eeds it With `memory_may_move` disabled, Winch treated `memory_reservation` as 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_size` as 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.
saulecabrera
force-pushed
the
winch-issue-oob
branch
from
October 10, 2026 20:29
1fddd8c to
90d3cdd
Compare
Member
Author
|
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 90d3cdd; decided to keep the run test since there was none covering this feature. |
alexcrichton
approved these changes
Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #14588
With
memory_may_movedisabled, Winch treatedmemory_reservationas anupper 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 theonly 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.