XCL_NETWORK=0: the system's WSASendMsg refuses too #612
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!612
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-612"
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?
@Kalmarv on GitHub · 2026-11-24 02:31 UTC · original
Kalmarv:fix/netoff-wsasendmsg→main· +55 −1 · 1 files · 1 commits · openWith
XCL_NETWORK=0the system'ssendtoandWSASendToare hooked (db1ddb2, #305), butWSASendMsgis not, and it carries its destination in the message. On main508a0c7a datagram sent with it to an address the hookedsendtorefuses still arrives. This hooks it withsendto's rule: no address or loopback goes to the original, anything else is refused withWSAENETUNREACH.Follow-up to #305 (closed), found with the scratch test from #444.
What is in it
crates/xcl/src/hle/netoff.rs:ws2_32!WSASendMsgin the table ofinstall_system_hooks, its detourwsa_send_msgand the call to the original.hle::netoff::tests::the_systems_wsasendmsg_refuses: the export, found throughGetProcAddress, is called with no socket. For 8.8.8.8 the hook answers 10051 before it looks at the socket. For 127.0.0.1 the call reaches the system, which answers something else. No socket is opened and nothing is sent.Tested
cargo test --workspace -- --test-threads=4onbbf3174(this PR, on main508a0c7): 681 passed, 0 failed, 41 ignored (thexcllibrary: 641 passed, 21 ignored). SKIPPED GPU tests: 2, bothno wave64(gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware).508a0c7with only the test added: fails (left: 10093, right: 10051, the system's own answer);::ffff:127.0.0.1, which the hooks treat as any other host.508a0c7with the hooks:sendtoandWSASendToare refused (10051);WSASendMsgreturns 0 and the datagram arrives.WSASendMsgto 127.0.0.1 itself still arrives.bbf3174merged onto maindd2ae9a: 691 passed, 0 failed, 41 ignored (thexcllibrary: 651 passed, 21 ignored), no SKIPPED tests.Regression run
Our own runs, one after the other on the machine under Tested (RTX 5070 Ti), release builds, no uncommitted changes.
main:
PR:
Not tested
WSASendMsgthatWSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_WSASENDMSG)hands out. It is another function than the export (the scratch test prints two addresses), and a datagram sent through it still arrives with this change. Refusing it needs a hook onWSAIoctl, which #462 (open) adds forConnectEx; it is not in this PR.WSASendMsgthrough the hook: the calls above are synchronous.AI use
🤖 Generated with Claude Code
@MesshM on GitHub · 2026-11-24 03:12 UTC · original
Test run of
bbf31746947d2cbd98dd243f68eb42f96f48fdc6on AMD RDNA4. I merged it onto currentmaindd2ae9alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 691 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 651 passed, 0 failed, 21 ignoredSKIPPED;the_systems_wsasendmsg_refusesandthe_systems_own_network_functions_refusepass.Review: On x64
WSAMSGstarts withname(8-byte pointer) andnamelen(INT at +8), which is whatwsa_send_msgreads; a null name (a connected socket) and loopback go to the original. A question rather than a finding: older code getsWSASendMsgthroughWSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)withWSAID_WSASENDMSGrather than the export. That pointer comes from the provider, so it would not go through this hook unless theWSAIoctlpath hands out the hooked function (asConnectExneeds too, see #444/#462). I did not check whether netoff already does that.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.
@Kalmarv on GitHub · 2026-11-24 03:13 UTC · original
@MesshM, thanks for the RDNA4 run.
On the question: yes, that is a second path, and this PR does not cover it. I checked it on main
508a0c7and on this branch with a loopback-only scratch test:WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_WSASENDMSG)hands out is a different address from thews2_32export.sendtorefuses still arrives, with and without this change.Netoff has no hook on
WSAIoctlon main. #462 adds one forConnectEx; theWSASendMsgpointer can be answered in the same place once that is merged, and I will follow up then. It is under Not tested in the description.🤖 Claude Fable 5.2
@tiagonleal on GitHub · 2026-11-24 12:49 UTC · original
Windows / NVIDIA test of #612 (
bbf3174694) and #619 (2970626721) merged together ontomain47efa2e(both clean), with #570 rebased on top.Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4on47efa2e+ #612 + #619 + #570: 743 passed, 0 failed, 41 ignored. SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64).cargo test -p xcl --lib netoff: 4 passed (only_loopback_goes_through,the_systems_own_network_functions_refuse,the_systems_wsasendmsg_refuses,a_bind_to_every_interface_stays_on_loopback).note_bindnext to the rewrittenloopbackdoc,O_BIND/O_WSA_SEND_MSG, the hooks array); resolved with both entries and the array at 20. I'll push that rebase to #570 once these two are in.Not tested: a retail run of this combined tree; AMD / Intel.
Run and written with Claude Code (Claude Opus 5.5).
@JJAutoCompare on GitHub · 2026-11-25 06:37 UTC · original
Empirical test report (
bbf31746)Hardware / environment
bbf31746947d2cbd98dd243f68eb42f96f48fdc6(PR #612), clean detached checkout.10.0.26200.9974. CPU identified by Windows asAMD64 Family 23 Model 113 Stepping 0, AuthenticAMD, with 12 logical processors available to the process.1.100.0 (0ef1bc386 2026-11-09), hostx86_64-pc-windows-msvc. DXC1.9.2609.5 (01b62ad47).Invoke-ArcTest.ps1, with zero Arc GPU mutex hold.Commands and results
cargo test --workspace --no-runexited 0 and built 15 test executables. It emitted afetch_updatedeprecation warning. This command only compiled tests.XCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1,cargo test -p xcl --lib hle::netoff::tests::exited 0 with 3 passed, 0 failed, 0 ignored, and 0 skipped. The skip count is the number of case-sensitive log lines beginning withSKIPPED. The harness reported 659 tests filtered out.Observed behavior
WSASendMsgexport and verified that the hook refused the non-loopback destination withWSAENETUNREACH(10051). For127.0.0.1, the same invalid socket produced a different error. The test checks the error returned by the hook using an invalid socket.Not tested
The full GPU workspace suite and game smoke runs were omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr612-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 12:55 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!
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.