Skip to content

[44.0.x] Fix leak in fd_renumber#13647

Merged
alexcrichton merged 2 commits into
bytecodealliance:release-44.0.0from
alexcrichton:back44
Jun 15, 2026
Merged

[44.0.x] Fix leak in fd_renumber#13647
alexcrichton merged 2 commits into
bytecodealliance:release-44.0.0from
alexcrichton:back44

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit fixes a file descriptor leak in the WASIp1 implementation of
fd_renumber in the wasmtime-wasi crate. Notably the previous
implementation did not fully close the file descriptor being
renumbered-to which meant that the host's resources for the file,
including the file descriptor, stayed alive. The fix here is to validate
both fds exist and then delegate to the fd_close call to close the
destination.

This additionally updates the behavior of fd_renumber when renumbering
to fds that weren't previously open to match the main branch which
notably rejects these calls.

This commit fixes a file descriptor leak in the WASIp1 implementation of
`fd_renumber` in the `wasmtime-wasi` crate. Notably the previous
implementation did not fully close the file descriptor being
renumbered-to which meant that the host's resources for the file,
including the file descriptor, stayed alive. The fix here is to validate
both fds exist and then delegate to the `fd_close` call to close the
destination.
@alexcrichton alexcrichton requested review from a team as code owners June 15, 2026 14:34
@alexcrichton alexcrichton requested review from fitzgen and pchickey and removed request for a team June 15, 2026 14:34
@alexcrichton alexcrichton merged commit 100bfe2 into bytecodealliance:release-44.0.0 Jun 15, 2026
177 checks passed
@alexcrichton alexcrichton deleted the back44 branch June 15, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants