Stream: git-wasmtime

Topic: wasmtime / PR #11384 Use the same `UdpSocket` in WASIp{2,3}


view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 17:48):

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

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 17:48):

alexcrichton opened PR #11384 from alexcrichton:refactor-wasi-udp-socket to bytecodealliance:main:

This commit refactors the implementation of wasi:sockets for WASIp2 and WASIp3 to use the same underlying host data structure for the UdpSocket resource in WIT. Previously each version of WASI had its own socket which resulted in duplicated code. There's some minor differences between WASIp2 and WASIp3 but it's easy enough to paper over with the same socket type. This is intended to help with the maintainability of this going forward to only have one type to operate on rather than two (which also ensures that bugfixes for one should affect the other).

One other change made in this commit is that sprinkled checks for whether or not UDP is allowed are all removed and canonicalized during UDP socket creation. This means that UDP socket creation is the only location that checks for whether UDP is allowed. Once a UDP socket is created it can be used freely regardless of whether the UDP setting is enabled or disabled. This is not intended to have a large practical effect but it does mean the behavior of hosts that deny UDP but manually give access to a UDP socket resource to a component may behave subtly differently.

<!--
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 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 (Aug 05 2025 at 18:03):

rvolosatovs submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 18:03):

rvolosatovs created PR review comment:

Could we clone the "check" from context here and avoid having to Arc::clone on each p3 usage of it?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 18:03):

rvolosatovs created PR review comment:

        socket.set_socket_addr_check(Some(check));

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 18:05):

rvolosatovs edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 19:19):

alexcrichton updated PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 19:22):

alexcrichton updated PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 19:24):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 19:24):

alexcrichton created PR review comment:

Unfortunately no because the check will live in the store no matter what and we can't borrow the store across awaits, so it's got to get moved out. This is mostly just here to handle how in WASIp2 the socket check is inherited from the Network type rather than unconditionally from WasiCtx. While esoteric it's possible for embedders to push their own Network without using WasiCtx which has a distinct check than the one in WasiCtx itself, although we might want to remove such a feature eventually (which would remove the need for this field here)

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 19:24):

alexcrichton has enabled auto merge for PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 20:06):

alexcrichton requested pchickey for a review on PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 20:06):

alexcrichton requested wasmtime-core-reviewers for a review on PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2025 at 20:06):

alexcrichton updated PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 06 2025 at 00:03):

alexcrichton updated PR #11384.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 06 2025 at 12:38):

rvolosatovs merged PR #11384.


Last updated: Dec 06 2025 at 06:05 UTC