XCL_NETWORK=0: the system's WSASendMsg refuses too #607

Merged
Kalmarv merged 1 commit from upstream-pr/612 into main 2026-11-28 23:48:56 +00:00
Kalmarv commented 2026-11-24 02:31:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-24T02:31:33Z.


With XCL_NETWORK=0 the system's sendto and WSASendTo are hooked (db1ddb2, #305), but WSASendMsg is not, and it carries its destination in the message. On main 508a0c7 a datagram sent with it to an address the hooked sendto refuses still arrives. This hooks it with sendto's rule: no address or loopback goes to the original, anything else is refused with WSAENETUNREACH.

Follow-up to #305 (closed), found with the scratch test from #444.

What is in it

  • crates/xcl/src/hle/netoff.rs: ws2_32!WSASendMsg in the table of install_system_hooks, its detour wsa_send_msg and the call to the original.
  • hle::netoff::tests::the_systems_wsasendmsg_refuses: the export, found through GetProcAddress, 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

  • RTX 5070 Ti, NVIDIA 610.74, Ryzen 9 9950X, Windows 11 Pro 26200; Rust 1.99.0, MSVC stable, debug.
  • cargo test --workspace -- --test-threads=4 on bbf3174 (this PR, on main 508a0c7): 681 passed, 0 failed, 41 ignored (the xcl library: 641 passed, 21 ignored). SKIPPED GPU tests: 2, both no wave64 (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware).
  • The new test:
    • main 508a0c7 with only the test added: fails (left: 10093, right: 10051, the system's own answer);
    • this change: passes.
  • A scratch test, not in the PR, loopback only: a UDP socket listens on 127.0.0.1 and is sent to as ::ffff:127.0.0.1, which the hooks treat as any other host.
    • main 508a0c7 with the hooks: sendto and WSASendTo are refused (10051); WSASendMsg returns 0 and the datagram arrives.
    • this change with the hooks: all three are refused (10051); WSASendMsg to 127.0.0.1 itself still arrives.
  • @MesshM's run on AMD (comment): Radeon RX 9060 XT 16 GB, driver 32.0.32029.2010, Ryzen 7 5700X, Windows 11 Pro 26200, Rust 1.100.0, debug. bbf3174 merged onto main dd2ae9a: 691 passed, 0 failed, 41 ignored (the xcl library: 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:

xcl-smoke v1
commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1512 (PresentX 1513)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14267 MB

PR:

xcl-smoke v1
commit: bbf31746947d2cbd98dd243f68eb42f96f48fdc6
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1509 (PresentX 1509)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14267 MB

Not tested

  • The WSASendMsg that WSAIoctl(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 on WSAIoctl, which #462 (open) adds for ConnectEx; it is not in this PR.
  • A title that sends datagrams, and any datagram to another machine.
  • An overlapped WSASendMsg through the hook: the calls above are synchronous.
  • Intel GPUs. Wine.
  • macOS / Linux: not built.
  • #462 (open) also adds a line to the hook table and changes its length, so whichever merges second needs a rebase.

AI use

  • Claude Code, Claude Fable 5.2: wrote the change, the test and this description; the runs above are its own.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5464973957 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-24T02:31:33Z. --- With `XCL_NETWORK=0` the system's `sendto` and `WSASendTo` are hooked (db1ddb2, #305), but `WSASendMsg` is not, and it carries its destination in the message. On main 508a0c7 a datagram sent with it to an address the hooked `sendto` refuses still arrives. This hooks it with `sendto`'s rule: no address or loopback goes to the original, anything else is refused with `WSAENETUNREACH`. Follow-up to #305 (closed), found with the scratch test from #444. **What is in it** - `crates/xcl/src/hle/netoff.rs`: `ws2_32!WSASendMsg` in the table of `install_system_hooks`, its detour `wsa_send_msg` and the call to the original. - `hle::netoff::tests::the_systems_wsasendmsg_refuses`: the export, found through `GetProcAddress`, 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** - RTX 5070 Ti, NVIDIA 610.74, Ryzen 9 9950X, Windows 11 Pro 26200; Rust 1.99.0, MSVC stable, debug. - `cargo test --workspace -- --test-threads=4` on `bbf3174` (this PR, on main `508a0c7`): 681 passed, 0 failed, 41 ignored (the `xcl` library: 641 passed, 21 ignored). SKIPPED GPU tests: 2, both `no wave64` (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`). - The new test: - main `508a0c7` with only the test added: fails (`left: 10093, right: 10051`, the system's own answer); - this change: passes. - A scratch test, not in the PR, loopback only: a UDP socket listens on 127.0.0.1 and is sent to as `::ffff:127.0.0.1`, which the hooks treat as any other host. - main `508a0c7` with the hooks: `sendto` and `WSASendTo` are refused (10051); `WSASendMsg` returns 0 and the datagram arrives. - this change with the hooks: all three are refused (10051); `WSASendMsg` to 127.0.0.1 itself still arrives. - @MesshM's run on AMD ([comment](https://github.com/ivall/xcl/pull/612#issuecomment-7120865570)): Radeon RX 9060 XT 16 GB, driver 32.0.32029.2010, Ryzen 7 5700X, Windows 11 Pro 26200, Rust 1.100.0, debug. `bbf3174` merged onto main `dd2ae9a`: 691 passed, 0 failed, 41 ignored (the `xcl` library: 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: ``` xcl-smoke v1 commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1512 (PresentX 1513) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14267 MB ``` PR: ``` xcl-smoke v1 commit: bbf31746947d2cbd98dd243f68eb42f96f48fdc6 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1509 (PresentX 1509) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14267 MB ``` **Not tested** - The `WSASendMsg` that `WSAIoctl(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 on `WSAIoctl`, which #462 (open) adds for `ConnectEx`; it is not in this PR. - A title that sends datagrams, and any datagram to another machine. - An overlapped `WSASendMsg` through the hook: the calls above are synchronous. - Intel GPUs. Wine. - macOS / Linux: not built. - #462 (open) also adds a line to the hook table and changes its length, so whichever merges second needs a rebase. **AI use** - Claude Code, Claude Fable 5.2: wrote the change, the test and this description; the runs above are its own. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MesshM commented 2026-11-24 07:05:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T03:12:00Z.


Test run of bbf31746947d2cbd98dd243f68eb42f96f48fdc6 on AMD RDNA4. I merged it onto current main dd2ae9a locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 691 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 651 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the_systems_wsasendmsg_refuses and the_systems_own_network_functions_refuse pass.

Review: On x64 WSAMSG starts with name (8-byte pointer) and namelen (INT at +8), which is what wsa_send_msg reads; a null name (a connected socket) and loopback go to the original. A question rather than a finding: older code gets WSASendMsg through WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER) with WSAID_WSASENDMSG rather than the export. That pointer comes from the provider, so it would not go through this hook unless the WSAIoctl path hands out the hooked function (as ConnectEx needs 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 onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

<!-- greyfinch-sync:ivall/xcl:comment:7120865570 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/612#issuecomment-7120865570). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T03:12:00Z. --- Test run of `bbf31746947d2cbd98dd243f68eb42f96f48fdc6` on AMD RDNA4. I merged it onto current `main` `dd2ae9a` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **691 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 651 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `the_systems_wsasendmsg_refuses` and `the_systems_own_network_functions_refuse` pass. **Review:** On x64 `WSAMSG` starts with `name` (8-byte pointer) and `namelen` (INT at +8), which is what `wsa_send_msg` reads; a null name (a connected socket) and loopback go to the original. A question rather than a finding: older code gets `WSASendMsg` through `WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)` with `WSAID_WSASENDMSG` rather than the export. That pointer comes from the provider, so it would not go through this hook unless the `WSAIoctl` path hands out the hooked function (as `ConnectEx` needs 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 onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Kalmarv commented 2026-11-24 07:05:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-24T03:13:28Z.


@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 508a0c7 and on this branch with a loopback-only scratch test:

  • The pointer that WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_WSASENDMSG) hands out is a different address from the ws2_32 export.
  • A datagram sent through it to an address the hooked sendto refuses still arrives, with and without this change.

Netoff has no hook on WSAIoctl on main. #462 adds one for ConnectEx; the WSASendMsg pointer 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

<!-- greyfinch-sync:ivall/xcl:comment:7120888073 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/612#issuecomment-7120888073). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-24T03:13:28Z. --- @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 508a0c7 and on this branch with a loopback-only scratch test: - The pointer that `WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_WSASENDMSG)` hands out is a different address from the `ws2_32` export. - A datagram sent through it to an address the hooked `sendto` refuses still arrives, with and without this change. Netoff has no hook on `WSAIoctl` on main. #462 adds one for `ConnectEx`; the `WSASendMsg` pointer 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 commented 2026-11-24 13:03:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-24T12:49:24Z.


Windows / NVIDIA test of #612 (bbf3174694) and #619 (2970626721) merged together onto main 47efa2e (both clean), with #570 rebased on top.

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1742), Ryzen 7 9800X3D, Windows 11 Pro 26300, rustc 1.100.0 MSVC, debug.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on 47efa2e + #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).
  • #570 on top conflicts as upipibi described on #570 (note_bind next to the rewritten loopback doc, 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).

<!-- greyfinch-sync:ivall/xcl:comment:7131966096 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/612#issuecomment-7131966096). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-24T12:49:24Z. --- Windows / NVIDIA test of #612 (`bbf3174694`) and #619 (`2970626721`) merged together onto `main` `47efa2e` (both clean), with #570 rebased on top. **Tested** - NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1742), Ryzen 7 9800X3D, Windows 11 Pro 26300, rustc 1.100.0 MSVC, debug. - `cargo build --workspace && cargo test --workspace -- --test-threads=4` on `47efa2e` + #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`). - #570 on top conflicts as upipibi described on #570 (`note_bind` next to the rewritten `loopback` doc, `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 commented 2026-11-25 07:05:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:37:05Z.


Empirical test report (bbf31746)

Hardware / environment

  • Commit bbf31746947d2cbd98dd243f68eb42f96f48fdc6 (PR #612), clean detached checkout.
  • Windows 10.0.26200.9974. CPU identified by Windows as AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD, with 12 logical processors available to the process.
  • Rust 1.100.0 (0ef1bc386 2026-11-09), host x86_64-pc-windows-msvc. DXC 1.9.2609.5 (01b62ad47).
  • The build and CPU-only run ran directly under Cargo, outside Invoke-ArcTest.ps1, with zero Arc GPU mutex hold.

Commands and results

  • cargo test --workspace --no-run exited 0 and built 15 test executables. It emitted a fetch_update deprecation warning. This command only compiled tests.
  • With XCL_ADAPTER=NONE_CPU_ONLY and RUST_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 with SKIPPED . The harness reported 659 tests filtered out.

Observed behavior

  • The new regression test resolved the system WSASendMsg export and verified that the hook refused the non-loopback destination with WSAENETUNREACH (10051). For 127.0.0.1, the same invalid socket produced a different error. The test checks the error returned by the hook using an invalid socket.
  • Both existing module tests passed. They cover IPv4 and IPv6 loopback classification and the behavior of hooked WinHTTP, WinINet, and Winsock lookup exports. The PR adds no integration tests.

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.

<!-- greyfinch-sync:ivall/xcl:comment:7154978960 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7154978960). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T06:37:05Z. --- ### Empirical test report (bbf31746) **Hardware / environment** - Commit `bbf31746947d2cbd98dd243f68eb42f96f48fdc6` (PR #612), clean detached checkout. - Windows `10.0.26200.9974`. CPU identified by Windows as `AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD`, with 12 logical processors available to the process. - Rust `1.100.0 (0ef1bc386 2026-11-09)`, host `x86_64-pc-windows-msvc`. DXC `1.9.2609.5 (01b62ad47)`. - The build and CPU-only run ran directly under Cargo, outside `Invoke-ArcTest.ps1`, with zero Arc GPU mutex hold. **Commands and results** - `cargo test --workspace --no-run` exited 0 and built 15 test executables. It emitted a `fetch_update` deprecation warning. This command only compiled tests. - With `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_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 with `SKIPPED `. The harness reported 659 tests filtered out. **Observed behavior** - The new regression test resolved the system `WSASendMsg` export and verified that the hook refused the non-loopback destination with `WSAENETUNREACH` (10051). For `127.0.0.1`, the same invalid socket produced a different error. The test checks the error returned by the hook using an invalid socket. - Both existing module tests passed. They cover IPv4 and IPv6 loopback classification and the behavior of hooked WinHTTP, WinINet, and Winsock lookup exports. The PR adds no integration tests. **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 commented 2026-11-25 13:05:17 +00:00 (Migrated from github.com)

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


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:7163049492 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7163049492). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T12:55:41Z. --- 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!
gut0to commented 2026-11-26 16:37:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T16:37:21Z.

Review: COMMENTED


AI-assisted review (OpenAI GPT-6); I checked this path against the diff and Microsoft Winsock documentation. I did not run tests or the game.

<!-- greyfinch-sync:ivall/xcl:review:6077660949 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#pullrequestreview-6077660949). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-26T16:37:21Z. **Review:** COMMENTED --- AI-assisted review (OpenAI GPT-6); I checked this path against the diff and Microsoft Winsock documentation. I did not run tests or the game.
gut0to commented 2026-11-26 16:37:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T16:37:22Z.

Code review location: crates/xcl/src/hle/netoff.rs; line 262

@@ -245,6 +256,17 @@ unsafe extern "system" fn wsa_send_to(_s: usize, _bufs: *const c_void, _n: u32,
     unreachable_net("WSASendTo")
 }
 
+/// WSASendMsg has its destination in the message (WSAMSG begins with the address and its
+/// length), so a datagram sent with it needs neither `sendto` nor `connect`. As in `sendto`:
+/// no address (a connected socket) or loopback goes to the original.
+unsafe extern "system" fn wsa_send_msg(s: usize, msg: *const c_void, flags: u32, sent: *mut u32, ov: *mut c_void, cb: *const c_void) -> i32 {

Could a regression resolve and call the WSASendMsg pointer returned by WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_WSASENDMSG)? The current test calls the ws2_32 export through GetProcAddress, but Microsoft documents that the extension pointer can invoke the provider directly without passing through Ws2_32. That leaves a path for non-loopback traffic to bypass this export hook while XCL_NETWORK=0. Please cover the returned pointer and ensure off-loopback sends remain refused. WSASendMsg, provider extension mechanism. AI-assisted review (OpenAI GPT-6); I checked this path against Microsoft documentation and did not run tests.

<!-- greyfinch-sync:ivall/xcl:review-comment:4711202201 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#discussion_r4711202201). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-26T16:37:22Z. **Code review location:** `crates/xcl/src/hle/netoff.rs`; line 262 ~~~~diff @@ -245,6 +256,17 @@ unsafe extern "system" fn wsa_send_to(_s: usize, _bufs: *const c_void, _n: u32, unreachable_net("WSASendTo") } +/// WSASendMsg has its destination in the message (WSAMSG begins with the address and its +/// length), so a datagram sent with it needs neither `sendto` nor `connect`. As in `sendto`: +/// no address (a connected socket) or loopback goes to the original. +unsafe extern "system" fn wsa_send_msg(s: usize, msg: *const c_void, flags: u32, sent: *mut u32, ov: *mut c_void, cb: *const c_void) -> i32 { ~~~~ --- Could a regression resolve and call the `WSASendMsg` pointer returned by `WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_WSASENDMSG)`? The current test calls the `ws2_32` export through `GetProcAddress`, but Microsoft documents that the extension pointer can invoke the provider directly without passing through `Ws2_32`. That leaves a path for non-loopback traffic to bypass this export hook while `XCL_NETWORK=0`. Please cover the returned pointer and ensure off-loopback sends remain refused. [WSASendMsg](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendmsg), [provider extension mechanism](https://learn.microsoft.com/en-us/windows/win32/winsock/provider-specific-extension-mechanism-2). AI-assisted review (OpenAI GPT-6); I checked this path against Microsoft documentation and did not run tests.
Kalmarv commented 2026-11-26 23:08:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T23:08:53Z.


@gut0to thanks. Confirmed by reading, not run: neither this PR (bbf3174) nor main (8b957be) hooks WSAIoctl, so a WSASendMsg taken from SIO_GET_EXTENSION_FUNCTION_POINTER / WSAID_WSASENDMSG calls the provider directly and skips this hook while XCL_NETWORK=0.

It is the same gap as #444: ConnectEx is only reachable through that pointer, and it still connects. Both are fixed in one place by hooking WSAIoctl and handing back a refusing detour for WSAID_WSASENDMSG and WSAID_CONNECTEX, with a test that resolves each pointer and checks that an off-loopback call is refused. That fix belongs with #444, as its own PR. This PR stays the ws2_32 export, which it closes as described. I'll link the #444 PR here when it is up.

AI use: Claude Code, Claude Opus 5.5 checked the code paths and wrote this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7205294772 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7205294772). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-26T23:08:53Z. --- @gut0to thanks. Confirmed by reading, not run: neither this PR (`bbf3174`) nor main (`8b957be`) hooks `WSAIoctl`, so a `WSASendMsg` taken from `SIO_GET_EXTENSION_FUNCTION_POINTER` / `WSAID_WSASENDMSG` calls the provider directly and skips this hook while `XCL_NETWORK=0`. It is the same gap as #444: `ConnectEx` is only reachable through that pointer, and it still connects. Both are fixed in one place by hooking `WSAIoctl` and handing back a refusing detour for `WSAID_WSASENDMSG` and `WSAID_CONNECTEX`, with a test that resolves each pointer and checks that an off-loopback call is refused. That fix belongs with #444, as its own PR. This PR stays the `ws2_32` export, which it closes as described. I'll link the #444 PR here when it is up. AI use: Claude Code, Claude Opus 5.5 checked the code paths and wrote this reply.
throny commented 2026-11-28 03:01:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:01:18Z.


merge-check claim
head: bbf3174694

<!-- greyfinch-sync:ivall/xcl:comment:7232741722 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7232741722). Originally posted by [throny](https://github.com/throny) on 2026-11-28T03:01:18Z. --- merge-check claim head: bbf31746947d2cbd98dd243f68eb42f96f48fdc6
throny commented 2026-11-28 03:16:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:16:03Z.


merge-check
base: 753e8b1a
head: bbf3174694
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1513 passed, 0 failed, 47 ignored; its test uses an invalid socket, so nothing is sent (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored
review: it weakens no existing block and adds one. The message layout it reads is right for x64. What passes: a message without an address (a connected socket, which can only be loopback because connect is hooked) and the IPv4 and IPv6 loopback addresses; an IPv4-mapped loopback address is refused, which is the conservative side. Known gap, acknowledged by the author and not new: a WSASendMsg pointer obtained from the provider through WSAIoctl skips this hook (main does not hook that call; ConnectEx has the same gap), so XCL_NETWORK=0 is not complete with this PR either. If the hook cannot be installed, the existing warning fires and the process runs on unblocked, as for the other hooks. Minor: a non-null but invalid message pointer faults inside the hook instead of returning an error.
performance: none; network path only, and only with XCL_NETWORK=0.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7232933508 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7232933508). Originally posted by [throny](https://github.com/throny) on 2026-11-28T03:16:03Z. --- merge-check base: 753e8b1a head: bbf31746947d2cbd98dd243f68eb42f96f48fdc6 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1513 passed, 0 failed, 47 ignored; its test uses an invalid socket, so nothing is sent (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored review: it weakens no existing block and adds one. The message layout it reads is right for x64. What passes: a message without an address (a connected socket, which can only be loopback because connect is hooked) and the IPv4 and IPv6 loopback addresses; an IPv4-mapped loopback address is refused, which is the conservative side. Known gap, acknowledged by the author and not new: a WSASendMsg pointer obtained from the provider through WSAIoctl skips this hook (main does not hook that call; ConnectEx has the same gap), so XCL_NETWORK=0 is not complete with this PR either. If the hook cannot be installed, the existing warning fires and the process runs on unblocked, as for the other hooks. Minor: a non-null but invalid message pointer faults inside the hook instead of returning an error. performance: none; network path only, and only with XCL_NETWORK=0. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
KOLESNiii commented 2026-11-28 12:05:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T12:05:18Z.


merge-check claim
head: bbf3174694

<!-- greyfinch-sync:ivall/xcl:comment:7238984797 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7238984797). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T12:05:18Z. --- merge-check claim head: bbf31746947d2cbd98dd243f68eb42f96f48fdc6
KOLESNiii commented 2026-11-28 12:40:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T12:40:07Z.


merge-check
base: e429936c10
head: bbf3174694
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_whole, gpu::dxil::module::split::tests::dispatch_chain_wave32_live_loops, gpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchange, gpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_output, gpu::recomp::tests::gpu_compute_mode_dispatch_abi, gpu::recomp::tests::gpu_float_cas_uses_ieee_equality, test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer, test_title_runs_under_the_debug_layer_with_dred: these 9 fail on the base too (the base e429936c's suite, run alone on this PC with the same command: 2126 passed, 9 failed, 48 ignored, 25 SKIPPED, these same 9 failing), and each also failed when rerun alone on this merge (the two debug-layer e2e tests stop on the D3D12 debug layer rejecting a pixel shader as corrupt or unsigned, and test_title_runs_and_game_folder_is_untouched on the test title's console command list memory-methods check, "post-Wait32/64 write failed"); not caused by this PR. The suite ran on this PC at the same time as 2 other PRs' suites, in one queued job.
review: none. Whole diff read (netoff.rs: WSASendMsg hooked like sendto: the destination is read from WSAMSG (name at +0, namelen at +8 on x64); no address or a loopback one goes to the original, any other is refused as unreachable; its own original pointer, no spare trampoline used; 1 test through the system's export, to another host and to loopback). Datagrams sent with WSASendMsg no longer bypass the offline mode.
performance: no runtime cost of note (one hook, on WSASendMsg calls only).
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 207e50beffbb072d474451e93bd234c0855f1270 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).
correction (2026-11-28): the base counts above were first given as 2128 passed: that base run reused this PC's merge test binary (one cargo target dir for both sides). The base was rerun with its own target dir; the same 9 tests fail on it, so the classification and the verdict stand.

<!-- greyfinch-sync:ivall/xcl:comment:7239385210 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/612#issuecomment-7239385210). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T12:40:07Z. --- merge-check base: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd head: bbf31746947d2cbd98dd243f68eb42f96f48fdc6 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_whole, gpu::dxil::module::split::tests::dispatch_chain_wave32_live_loops, gpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchange, gpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_output, gpu::recomp::tests::gpu_compute_mode_dispatch_abi, gpu::recomp::tests::gpu_float_cas_uses_ieee_equality, test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer, test_title_runs_under_the_debug_layer_with_dred: these 9 fail on the base too (the base e429936c's suite, run alone on this PC with the same command: 2126 passed, 9 failed, 48 ignored, 25 SKIPPED, these same 9 failing), and each also failed when rerun alone on this merge (the two debug-layer e2e tests stop on the D3D12 debug layer rejecting a pixel shader as corrupt or unsigned, and test_title_runs_and_game_folder_is_untouched on the test title's console command list memory-methods check, "post-Wait32/64 write failed"); not caused by this PR. The suite ran on this PC at the same time as 2 other PRs' suites, in one queued job. review: none. Whole diff read (netoff.rs: WSASendMsg hooked like sendto: the destination is read from WSAMSG (name at +0, namelen at +8 on x64); no address or a loopback one goes to the original, any other is refused as unreachable; its own original pointer, no spare trampoline used; 1 test through the system's export, to another host and to loopback). Datagrams sent with WSASendMsg no longer bypass the offline mode. performance: no runtime cost of note (one hook, on WSASendMsg calls only). verdict: safe to merge hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 207e50beffbb072d474451e93bd234c0855f1270 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft). correction (2026-11-28): the base counts above were first given as 2128 passed: that base run reused this PC's merge test binary (one cargo target dir for both sides). The base was rerun with its own target dir; the same 9 tests fail on it, so the classification and the verdict stand.
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!607
No description provided.