XCL_NETWORK=0: a bind to a network address binds to loopback #570
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!570
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-570"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tiagonleal on GitHub · 2026-11-24 01:56 UTC · original
tiagonleal:netoff-bind-loopback→main· +213 −1 · 1 files · 2 commits · openWith
XCL_NETWORK=0a retail title still bound UDP 3074 on0.0.0.0:netoffrefusedconnect,sendtoand name lookups, but notbind. Windows Firewall then asked to let the network in forxcl.exe(once per folder it runs from; "Allow" needs an administrator), and once allowed, the network reached the title's socket. Fixes #568.A bind to a non-loopback IPv4 / IPv6 address now binds to
127.0.0.1/::1on the same port. The bind succeeds as on a console without a network, the title's loopback traffic still reaches the socket, nothing from the network does, and Windows does not ask. IPv4-mapped addresses (::ffff:a.b.c.d) are not loopback, so they end up on::1too.Rebased onto
main08db8020; the second commit only adds tests and a doc comment. The bind is logged (note_bind) only after it succeeded: before, the 24-byte IPv6 form that Winsock refuses withWSAEFAULTwas logged as bound to::1.What is in it
crates/xcl/src/hle/netoff.rs: abindhook, in the title's ws2_32 imports (table(), ordinal 2) and in the system'sws2_32!bind(install_system_hooks), next toconnect's; loopback binds go through unchanged.a_bind_to_every_interface_stays_on_loopback: UDP and TCP binds to0.0.0.0:0end up on127.0.0.1, loopback traffic reaches them,[::]:0ends up on::1when the machine has IPv6.ws2_32!bindon rawAF_INET6sockets (port 0; skipped when the machine has no IPv6) and a doc comment:an_ipv6_bind_stays_on_loopback: a 28-bytesockaddr_in6for::, for2001:db8::1and for::with a scope id ends up on::1with the port kept;::1stays.a_sockaddr_in6_under_28_bytes_is_left_alone: lengths 0, 2, 8, 20, 23 and 24, exact-size buffers and a null name are passed on as they are; Winsock itself refuses the older 24-byte form (WSAEFAULT), also for::1, so that form fails as without the hook and the socket stays unbound.a_dual_stack_bind_is_on_ipv6_loopback_only: anIPV6_V6ONLY=0TCP listener bound to::is on::1only: an IPv6 loopback connection reaches it, an IPv4 one to the same port is refused.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4, run twice at8948d93d: 1429 passed, 4 failed, 47 ignored both times (25SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3(CreateComputePipelineState, E_OUTOFMEMORY on this GPU), in code this PR does not touch; I did not run them onmain08db8020today. Thelower_dxilbarrier test that failed at the earlier head passes after the rebase.cargo test -p xcl --lib netoff -- --test-threads=1at8948d93d: 6 passed, 0 failed, 3 of 3 runs. With thebindhook returning at once to the originalbind: 3 failed, 3 passed (a_bind_to_every_interface_stays_on_loopback:left: 0.0.0.0,right: 127.0.0.1;an_ipv6_bind_stays_on_loopbackanda_dual_stack_bind_is_on_ipv6_loopback_only:leftall zeros,right::1).wave64GPU tests, threelower_dxilf16 / conversion forms refused as unsupported, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Get-NetUDPEndpoint25 s into each smoke run:main0.0.0.0:3074; this PR127.0.0.1:3074, and the log saysXCL_NETWORK=0: a bind to a network address is bound to 127.0.0.1 instead (no network)(measured on the earlier headeaf034e4; not repeated on8948d93d, and the hook has changed since only in when the log line is written).Regression run
First block:
main08db8020; second: this PR's head8948d93d; same title, built from clean trees.Not tested
::and expects IPv4 loopback connections to it (after this it is on::1only; pinned by a test, no real title run).AF_UNSPEC, and UDP dual-stack delivery (only the TCP listener is tested).AI use
@FelipeCRamos on GitHub · 2026-11-24 02:08 UTC · original
claude code session is invalid anyway, might as well remove it ;)
@MesshM on GitHub · 2026-11-24 03:33 UTC · original
Test run of
fc1e7a99f186a028bda6d02b1067b330f98fb4a4on AMD RDNA4. I merged it onto currentmain91f9a5elocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 693 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 653 passed, 0 failed, 21 ignoredSKIPPED;a_bind_to_every_interface_stays_on_loopbackpasses.Review: A bind to a network address (or to every interface) is moved to loopback with its port kept, so a title's sockets still bind and the firewall prompt from #568 no longer comes up; loopback binds go to the original. I found nothing to change.
Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@tiagonleal on GitHub · 2026-11-24 11:45 UTC · original
@FelipeCRamos dropped the session trailer; the commit is otherwise unchanged.
@upipibi thanks for checking the merge order. Rebased onto
main47efa2e(clean, same diff). If #612 and #619 go in first I'll rebase again and the hooks array becomes 20 with both thebindandWSASendMsgentries. New test counts and both smoke blocks are in the description;Get-NetUDPEndpoint25 s in:main0.0.0.0:3074, this PR127.0.0.1:3074.AI-assisted (Claude Code).
@zorde23 on GitHub · 2026-11-24 15:49 UTC · original
AMD RX 6750 XT data point for #570 (RDNA2, driver 32.0.21045.29003; Ryzen 7 5700X, 32 GB; Windows 11 Pro 26200; release builds)
eaf034echerry-picks cleanly onto current main930e8b4(local commit4b7356a, which is the commit in the PR smoke block below). Both builds came from fresh worktrees, so eachxcl.exewas at a path Windows Firewall had never seen. Retail title of #505,XCL_NETWORK=0, 60 s smoke each, with the UDP endpoints of thexcl.exeprocesses polled every 2 s (Get-NetUDPEndpoint -OwningProcess):xcl.exe930e8b40.0.0.0:3074(first seen ~8 s into the run)930e8b4127.0.0.1:3074for the whole runXCL_NETWORK=0: a bind to a network address is bound to 127.0.0.1 instead (no network), 5.6 s in. No other listening socket (TCP or UDP) on either run.bind).cargo test --workspace --no-fail-fast -- --test-threads=4: main 748 passed, 3 failed, 41 ignored; #570 749 passed, 3 failed, 41 ignored (the +1 isnetoff::a_bind_to_every_interface_stays_on_loopback, which passes). The 3 failures (title_textures::placed_title_textures_share_vram_and_preserve_pixels,title_textures::transitions_apply_when_their_list_is_submitted,vram::d32s8_targets_take_their_own_size_of_video_memory) fail on this GPU on main too.main:
PR:
Written with Claude Code from runs on this machine.
@tiagonleal on GitHub · 2026-11-24 15:52 UTC · original
@zorde23 thanks for the RDNA2 run. For your last "not tested" point: #570 merged with the other eight open netoff PRs (#462, #612, #619, #807, #808, #821, #494, #299) builds and passes the whole suite on the RTX 5070 Ti (758 passed, 0 failed, 41 ignored; 7 netoff tests); the merge order and resolutions are in my comment on #568.
AI-assisted (Claude Code).
@JJAutoCompare on GitHub · 2026-11-25 06:58 UTC · original
Independent Windows x64 test report on commit
eaf034e43c2273b2a409cb92788449991a332b4f.Environment
rustc 1.100.0 (0ef1bc386 2026-11-09)XCL_ADAPTER=NONE_CPU_ONLY)Command
Results
hle::netoff::tests::a_bind_to_every_interface_stays_on_loopback: okhle::netoff::tests::only_loopback_goes_through: okNot tested
AI use
gemini-4-neon).@DavidM1911 on GitHub · 2026-11-25 13:18 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@upipibi on GitHub · 2026-11-24 04:03 UTC · original · edited 2026-11-25 20:44 UTC
Merge-order note for the three
XCL_NETWORK=0PRs that touchcrates/xcl/src/hle/netoff.rs. I merged each pair ontomainf4ce27ceb6, heads #570fc1e7a99f1, #612bbf3174694and #6192970626721:[…; 19]with 19 entriesnote_bindis inserted right above theloopbackdoc comment that #619 rewritesO_BINDnext toO_WSA_SEND_MSG, and both changehooks: [...; 18]to19So the simplest order is #619 and #612 first, then a rebase of #570. Its hooks array then becomes
20, with both thebindandWSASendMsgentries.I also read #619 and #612:
a[..10]zero,a[10..12] == ff ff,a[12] == 127) is the RFC 4291 IPv4-mapped layout at thesockaddr_in6address offset.WSAMSG.nameat offset 0 andnamelenat offset 8, which is the x64 layout.(Above: read only, not built.)
Added 20:44Z: whole workspace at the current head
3449a3f(as is, base3f27770), RTX 3070 8 GB (Ampere), driver 616.56, Windows 11, debug, aftercargo build --workspace,cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2 --skip gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier: 1351 passed, 0 failed, 46 ignored. The end-to-end title tests pass.a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(this head's base has that test but not its fix, #2420) andhle::xaudio2(fails or hangs on this machine onmaintoo). The PR touches neither.no wave64, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, 1 PSO measurement that needs Developer Mode.AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
@thehollowedone on GitHub · 2026-11-25 23:39 UTC · original
Independent Windows/NVIDIA check of head
3449a3f, plus a local, uncommitted integration with currentmain08db802.Tested
cargo test -p xcl --lib netoff -- --test-threads=1 --nocapture: 6 passed, 0 failed, no IPv6 skip. IPv4, IPv6 and dual-stack loopback binding tests ran.cargo build --workspacepassed;cargo test --workspace --no-fail-fast -- --test-threads=4: 1,360 passed, 1 failed, 46 ignored, with 25 explicitSKIPPEDnotices. The sole failure wasa_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(3 barriers versus its old expected count of 1); it failed again alone.main(1/0). Since this PR's base, main changed that test's assertion to count barriers after the entry branch. A conflict-freegit merge --no-commitof this head into08db802changed onlynetoff.rs;cargo build --workspaceand the full workspace test then passed: 1,433 passed, 0 failed, 47 ignored, with 25 explicit skips (21 no native wave64, three refused per-lane cases, one unavailable heap-window case). No merge commit or push was made.Rebasing this PR onto current
mainshould bring in the updated barrier assertion. The clean rebased head would still need its own suite and paired smoke run under the PR rules. One small diagnostic detail: the 24-byte IPv6 bind case fails withWSAEFAULTas tested, butnote_bindprints that it was bound to::1before Winsock returns; logging only after a successful bind would make that message accurate.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-26 03:00 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
3449a3f383to8948d93d9d@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 02:11 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@tiagonleal on GitHub · 2026-11-26 11:53 UTC · original
Thanks. The branch is now rebased on
main08db8020, in two commits (75b301b8,8948d93d).note_bindnow logs only after the bind succeeds, so the 24-byte IPv6 case, which Winsock refuses withWSAEFAULT, no longer says it was bound to::1. That change has no test of its own.Run on
8948d93d:cargo test -p xcl --lib netoff -- --test-threads=1, 6 passed, 3 of 3 runs. With thebindhook taken out, 3 fail and 3 pass (the same three that fail without the fix).cargo test --workspace --no-fail-fast -- --test-threads=4, twice: 1429 passed, 4 failed, 47 ignored, 25 SKIPPED lines; the 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(E_OUTOFMEMORY on this machine). The barrier test you saw failing passes after the rebase. 60 s smoke runs on08db8020and8948d93d: both exit 0, no device removals, 1603 and 1618 frames shown.Not run: a retail title with the firewall prompt on this machine, AMD hardware, and the four fuzz tests on
maintoday.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.