fix: accept unimplemented socket options, bump 0.3.0 - #39
Merged
Conversation
The 0.2.0 setsockopt/getsockopt hardening changed silent no-ops into errors for unrecognised options. This broke DNS resolution because musl's resolver sets IP_RECVERR (level=0, opt=11) on its UDP socket and aborts when the setsockopt fails. Revert to accepting unknown options silently — for a socket-proxy pattern the guest OS manages its own socket semantics, so unknown options are harmless configuration hints, not security boundaries. Signed-off-by: danbugs <danilochiarlone@gmail.com>
Signed-off-by: danbugs <danilochiarlone@gmail.com>
Contributor
There was a problem hiding this comment.
Linux Benchmarks
Details
| Benchmark suite | Current: fe6972d | Previous: cb048d7 | Ratio |
|---|---|---|---|
hello_world (median) |
20 ms |
20 ms |
1 |
pandas (median) |
100 ms |
100 ms |
1 |
density (per VM) |
7 MB |
7 MB |
1 |
snapshot (disk) |
385 MiB |
385 MiB |
1 |
This comment was automatically generated by workflow using github-action-benchmark.
Contributor
There was a problem hiding this comment.
Windows Benchmarks
Details
| Benchmark suite | Current: fe6972d | Previous: cb048d7 | Ratio |
|---|---|---|---|
hello_world (median) |
260 ms |
218 ms |
1.19 |
pandas (median) |
840 ms |
739 ms |
1.14 |
density (per VM) |
6 MB |
6 MB |
1 |
snapshot (disk) |
393 MiB |
393 MiB |
1 |
This comment was automatically generated by workflow using github-action-benchmark.
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.
Summary
Root cause
The v0.2.0
setsockopt/getsockopthardening changed silent no-opsinto errors for unrecognised socket options. This broke DNS resolution
because musl's resolver sets
IP_RECVERR(IPPROTO_IP=0, optname=11)on its UDP socket and aborts when the
setsockoptcall fails.Traced via
HL_DISPATCH_DEBUG=1— the very first thing afternet_socketisnet_setsockopt(level=0, optname=11, value=1), whichreturned an error and caused the guest to close the socket immediately.
Fix
Revert
setsockoptto accepting unknown options silently andgetsockoptto returning 0 for unknown options. For a socket-proxypattern, the guest OS manages its own socket semantics — unknown
options are harmless configuration hints, not security boundaries.
Known options (
SO_REUSEADDR,SO_KEEPALIVE,TCP_NODELAY) arestill applied to the host socket.
Test plan
cargo test --libpasses on Linux (46/46) and Windows (38/38)cargo clippy --all-targets -- -D warningsclean on both platformsnetworking-py urllib_getpasses locally with the fix (was failing with v0.2.0)networking-pyruntime tests