Skip to content

XCL_NETWORK=0: GetAddrInfoExW answers local names like getaddrinfo does - #2312

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
gefydev:netoff-getaddrinfoex-local-names
Nov 25, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
gefydev:netoff-getaddrinfoex-local-names

Conversation

@gefydev

@gefydev gefydev commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

With XCL_NETWORK=0, GetAddrInfoExW refused every name, localhost and the machine's own name included. The module promises that lookups of local names keep working, and getaddrinfo and GetAddrInfoW keep that promise by calling the original for them; the Ex entry, which the async lookups use, was hooked with a refusal for all names. A title that resolved its own name that way got WSAHOST_NOT_FOUND (11001).

What is in it

  • crates/xcl/src/hle/netoff.rs: a declaration of the system's GetAddrInfoExW, its original (O_GETADDRINFO_EX, with the orig_ wrapper the other two have) and the hook table's entry using it instead of a spare trampoline. getaddrinfo_ex reads the name as getaddrinfo_w does (null is the empty name), calls the original with all ten arguments for a local name, and refuses the rest as before, now naming the host in the log line.
  • Test: the_systems_own_network_functions_refuse also calls the system's GetAddrInfoExW through GetProcAddress: example.com is still refused with 11001 and out stays null, localhost reaches the original.

Tested

  • NVIDIA GeForce GTX 1650 (4 GB, 32-lane waves only), driver 621.24, AMD Ryzen 5 1600, 16 GB RAM, Windows 11 Pro 10.0.26300, Rust 1.100.0, debug for the tests and release for the regression runs.
  • The new assertion fails without the change (assertion left != right failed, both 11001, for localhost) and passes with it. Nothing leaves the machine: the names are example.com, refused before any lookup, and localhost.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on ed56bca: 1250 passed, 0 failed, 46 ignored. 26 SKIPPED, none of them on a path this change touches: 20 wave64 cases ("no wave64" on this GPU), 3 per-lane f16 cases the per-lane form refuses, 1 "no heap windows", 2 for the D3D12 debug layer not being installed.

Regression run
scripts/smoke.ps1 -Game <title folder> -Seconds 60, release builds, the same machine and title for both, one after the other. The smoke runs set XCL_NETWORK=0, so they do load the hooks.

main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: NVIDIA GeForce GTX 1650
title: eddfb802
seconds: 60
exit: 0x0
frames shown: 911 (PresentX 911)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 11671 MB

PR:

xcl-smoke v1
commit: ed56bca4c3d31b2d928e545d5a9a9a222932099f
gpu: NVIDIA GeForce GTX 1650
title: eddfb802
seconds: 60
exit: 0x0
frames shown: 916 (PresentX 917)
presents per 2 s (last 3): 1 0 0
device removals: 0
crashes: 0
peak commit: 11449 MB

Not tested

AI use

  • Claude Code, Claude Sonnet 5.5: found the defect, wrote the change, the test and this description, and ran the checks.

The module promises that lookups of local names (none, this machine's name,
localhost) keep working under XCL_NETWORK=0, and getaddrinfo and GetAddrInfoW
keep that promise by calling the original for them. GetAddrInfoExW, the entry
the async lookups use, was hooked with a refusal for every name, so a title that
resolved its own name through it got WSAHOST_NOT_FOUND. It now reads the name
the same way, calls the original for local names through its own trampoline and
refuses the rest as before.
@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

CPU-only review of #2312 at head ed56bca4c3d31b2d928e545d5a9a9a222932099f, on origin/main afc5ee86ae3a9521c9f15d96505cd73fe72f2191 (the PR is based on 1a0bbe3; it merges into current main without conflicts).

Tested

Review

Not tested

  • The full workspace suite and any GPU test (the GPU was in use by another job), the integration / e2e binaries, and scripts/smoke.ps1 / any title run. This is not a replacement for the GPU suite or the smoke run the PR template asks for.

AI use

  • Review and test run written by Claude Code (Claude Sonnet 5.5), from a real run on Windows 11 (10.0.26200), stable-x86_64-pc-windows-msvc, debug build, CPU only. I read the full diff; nothing was changed or pushed.

@gefydev

gefydev commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@oni-swr thank you for the review of #2312 at ed56bca: hle::netoff:: 2 passed, 0 failed, a clean merge with #808 and #821 (git merge-tree), and no issues. Agreed on both points: only the synchronous call is in the test, the overlapped path was read and not run, and whichever of #808 and this PR lands second should rerun the_systems_own_network_functions_refuse, because #808 changes what local_name accepts.

AI use: Claude Code (Claude Sonnet 5.5) wrote this comment for @gefydev.

@nnonno91

Copy link
Copy Markdown

Independent Windows event-based asynchronous localhost check on ed56bca4c3d31b2d928e545d5a9a9a222932099f.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, unoptimized profile. XCL_NETWORK=0.
  • cargo test --locked -p xcl --lib hle::netoff:: -- --nocapture --test-threads=1 gave 2 passed, 0 failed on the unchanged head.
  • I temporarily extended the_systems_own_network_functions_refuse after the existing hook checks. It initialized Winsock and called the hooked GetAddrInfoExW for localhost with an OVERLAPPED event. The call returned 997, the event signaled within five seconds, and GetAddrInfoExOverlappedResult returned 0 with a non-null address result. The added lookup was local.
  • cargo test --locked -p xcl --lib hle::netoff::tests::the_systems_own_network_functions_refuse -- --exact --nocapture --test-threads=1 gave 1 passed, 0 failed. Both runs had 0 ignored and no skips. The temporary fixture edit was restored.

Not tested

Completion-routine callbacks, a retail title and the full workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) added the temporary asynchronous check, ran the tests and wrote this report.

@throny throny added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 25, 2026
@gefydev

gefydev commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@nnonno91 thank you for the asynchronous check of #2312 at ed56bca (Ryzen 7 9800X3D, Windows 11 build 26200.9974, Rust 1.100.0, XCL_NETWORK=0, unoptimized profile). It covers the overlapped path the description lists as not tested: hle::netoff:: 2 passed, 0 failed on the unchanged head, and with your temporary fixture the hooked GetAddrInfoExW for localhost with an OVERLAPPED event returned 997, the event signaled within five seconds, and GetAddrInfoExOverlappedResult returned 0 with a non-null address result. Completion-routine callbacks, a title and the full suite were not part of your run, as you say.

AI use: Claude Code (Claude Sonnet 5.5) wrote this comment for @gefydev.

@raylitebull
raylitebull merged commit e9f129d into xcl-dev:main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants