Stream: git-wasmtime

Topic: wasmtime / PR #14487 Fix leaking host padding bytes to gu...


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

alexcrichton opened PR #14487 from alexcrichton:fix-fd-readdir to bytecodealliance:main:

This commit is a fix to the implementation of the WASIp1 function fd_readdir. This notably removes the unsafe internally used to implement the function. Previously the host Dirent stucture was copied as-is to the guest, but this had two independent bugs. First the host's undefined padding bytes were copied to the guest meaning that up to 3 bytes of host memory was leaked to the guest. Second was that the host structure wasn't tagged #[repr(C)] so future versions of a Rust compiler could reorder the structure's fields.

The fix here is to manually serialize the Dirent into a host-side buffer. This serialization is now all done without unsafe meaning the everything is fully defined, notably padding bytes are unconditionally defined as zero now.

<!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

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 02 2026 at 16:09):

alexcrichton requested pchickey for a review on PR #14487.

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

alexcrichton requested wasmtime-wasi-reviewers for a review on PR #14487.

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

:thumbs_up: adamrk submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 02 2026 at 17:46):

github-actions[bot] added the label wasi on PR #14487.

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

alexcrichton added PR #14487 Fix leaking host padding bytes to guests in fd_readdir to the merge queue

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

:check: alexcrichton merged PR #14487.

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

alexcrichton removed PR #14487 Fix leaking host padding bytes to guests in fd_readdir from the merge queue


Last updated: Oct 11 2026 at 04:10 UTC