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

Merged
gefydev merged 1 commit from upstream-pr/2312 into main 2026-11-25 16:15:58 +00:00
gefydev commented 2026-11-25 13:32:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-25T13:32:55Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6605652876 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2312). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-25T13:32:55Z. --- 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.
oni-swr commented 2026-11-25 14:10:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T13:45:47Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7164252735 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7164252735). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T13:45:47Z. --- **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.
gefydev commented 2026-11-25 14:10:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-25T13:48:06Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7164310047 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7164310047). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-25T13:48:06Z. --- @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 commented 2026-11-25 15:07:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T14:47:07Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7165810635 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7165810635). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T14:47:07Z. --- 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.
gefydev commented 2026-11-25 16:12:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-25T15:16:56Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7166592123 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7166592123). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-25T15:16:56Z. --- @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.
upstream-sync closed this pull request 2026-11-25 17:06:50 +00:00
DavidM1911 commented 2026-11-25 18:04:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T17:41:19Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7169858455 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2312#issuecomment-7169858455). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T17:41:19Z. --- 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!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2302
No description provided.