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

Manually merged
github merged 1 commit from gh-pr/2312/head into gh-pr/2312/base 2026-11-26 05:26:53 +00:00
Owner

@⁠gefydev on GitHub · 2026-11-25 13:32 UTC · original
gefydev:netoff-getaddrinfoex-local-names → main · +28 −3 · 1 files · 1 commits · merged 2026-11-25 16:15 UTC

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

  • An asynchronous GetAddrInfoExW (an overlapped call with a completion routine) for a local name: the hook passes all ten arguments to the original unchanged, but only the synchronous call is in the test.
  • A title that resolves its own name this way; AMD GPUs and native wave64; the world load.
  • Other open PRs change nearby lines of netoff.rs (#808 local_name, #807 WSASendTo, #619 mapped loopback); none changes this hook.

AI use

  • Claude Code, Claude Sonnet 5.5: found the defect, wrote the change, the test and this description, and ran the checks.
**@⁠gefydev** on GitHub · 2026-11-25 13:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/2312) `gefydev:netoff-getaddrinfoex-local-names` → `main` · +28 −3 · 1 files · 1 commits · merged 2026-11-25 16:15 UTC 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** - An asynchronous `GetAddrInfoExW` (an overlapped call with a completion routine) for a local name: the hook passes all ten arguments to the original unchanged, but only the synchronous call is in the test. - A title that resolves its own name this way; AMD GPUs and native wave64; the world load. - Other open PRs change nearby lines of `netoff.rs` (#808 `local_name`, #807 `WSASendTo`, #619 mapped loopback); none changes this hook. **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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:26:51 +00:00
github manually merged commit ed56bca4c3 into gh-pr/2312/base 2026-11-26 05:26:53 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 13:45 UTC · original

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

  • Built a throwaway merge of #2310, #2311 and #2312 onto origin/main (all three merge cleanly together) and ran cargo test -p xcl --lib --no-run: compiles; the 2 warnings are in code these PRs do not touch.
  • cargo test -p xcl --lib hle::netoff:: -- --test-threads=1: 2 passed, 0 failed, 0 ignored (the_systems_own_network_functions_refuse now also calls the hooked GetAddrInfoExW: an external name gets WSAHOST_NOT_FOUND and a null result, localhost does not). These tests install the process-wide hooks and use only loopback; no network traffic to outside hosts.

Review

  • The hook now forwards local names to the real function through its own trampoline (O_GETADDRINFO_EX), as getaddrinfo / GetAddrInfoW already do, and logs the name for refused lookups. A null name is treated as the empty name. The async arguments (overlapped, completion routine, handle) are passed through unchanged for local names. The test only covers the synchronous call; the async/overlapped path was read, not run. No issues found.
    Overlap
  • #808 and #821 also edit hle/netoff.rs (local_name parsing, WSAConnectByList). Both merge with this PR without conflicts (checked with git merge-tree), but #808 changes what local_name accepts, which this PR now also uses for GetAddrInfoExW; whichever lands second should rerun this test.

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.
**@⁠oni-swr** on GitHub · 2026-11-25 13:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7164252735) **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** - Built a throwaway merge of #2310, #2311 and #2312 onto `origin/main` (all three merge cleanly together) and ran `cargo test -p xcl --lib --no-run`: compiles; the 2 warnings are in code these PRs do not touch. - `cargo test -p xcl --lib hle::netoff:: -- --test-threads=1`: 2 passed, 0 failed, 0 ignored (`the_systems_own_network_functions_refuse` now also calls the hooked `GetAddrInfoExW`: an external name gets `WSAHOST_NOT_FOUND` and a null result, `localhost` does not). These tests install the process-wide hooks and use only loopback; no network traffic to outside hosts. **Review** - The hook now forwards local names to the real function through its own trampoline (`O_GETADDRINFO_EX`), as `getaddrinfo` / `GetAddrInfoW` already do, and logs the name for refused lookups. A null name is treated as the empty name. The async arguments (overlapped, completion routine, handle) are passed through unchanged for local names. The test only covers the synchronous call; the async/overlapped path was read, not run. No issues found. **Overlap** - #808 and #821 also edit `hle/netoff.rs` (`local_name` parsing, `WSAConnectByList`). Both merge with this PR without conflicts (checked with `git merge-tree`), but #808 changes what `local_name` accepts, which this PR now also uses for `GetAddrInfoExW`; whichever lands second should rerun this test. **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.
Author
Owner

@⁠gefydev on GitHub · 2026-11-25 13:48 UTC · original

@⁠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.

**@⁠gefydev** on GitHub · 2026-11-25 13:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7164310047) @⁠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.
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 14:47 UTC · original

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.

**@⁠nnonno91** on GitHub · 2026-11-25 14:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7165810635) 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.
Author
Owner

@⁠gefydev on GitHub · 2026-11-25 15:16 UTC · original

@⁠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.

**@⁠gefydev** on GitHub · 2026-11-25 15:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7166592123) @⁠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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:41 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!

**@⁠DavidM1911** on GitHub · 2026-11-25 17:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7169858455) 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.