badeend opened PR #12225 from badeend:implicit-binds to bytecodealliance:main:
In 0.2, implicit binds were explicitly forbidden, because that would bypass the concept of network handles.
0.3 doesn't have network handles and sockets are allowed to perform implicit binds again. This affects:Eventually, this will also allow us to remove the double bookkeeping like this from wasi-libc.
badeend requested wasmtime-wasi-reviewers for a review on PR #12225.
badeend requested dicej for a review on PR #12225.
badeend requested wasmtime-core-reviewers for a review on PR #12225.
badeend updated PR #12225.
alexcrichton submitted PR review:
Thanks for the comprehensive tests and the implementation here, much appreciated!
badeend updated PR #12225.
badeend updated PR #12225.
badeend commented on PR #12225:
Interesting. I was under the impression that implicit bind was a well-known universal behavior, but after some more research it appears to be a bit more nuanced than I thought. I've added a comment in the code with my findings.
But practically, Linux & MacOS both successfully ran to completion with:
test p3::p3_sockets_tcp_listen ... okSo they perform an implicit bind as expected (but not clearly documented). I assume this behavior extrapolates to other *BSD flavors.
But apparently, Windows _requires_
bindto be called beforelisten. To take away any potential platform-specific differences, I've updated the code to always perform the "implicit" bind ourselves in case the socket wasn't explicitly bound by the guest.Assuming this actually fixes the CI problems, I'll open a PR for a spec change to add a clarification on the
listenmethod.@alexcrichton Could you review the changes I just added?
alexcrichton commented on PR #12225:
Sounds right to me yeah, and thanks for investigating!
alexcrichton merged PR #12225.
Last updated: Jan 09 2026 at 13:15 UTC