VFS: protect game folders on network shares from direct writes (#961) #1077

Open
github-bot wants to merge 1 commit from github-bot/gh-1077 into main AGit
Owner

@⁠mahfuzinam0045-spec on GitHub · 2026-11-24 11:22 UTC · original
mahfuzinam0045-spec:fix/vfs-unc-game-root → main · +34 −1 · 1 files · 1 commits · open

Vfs::classify_with unconditionally returned Target::Pass for any path starting with \\\\ before comparing the path with the game root. When the game root is hosted on a UNC network share (\\\\server\\share\\Game), any title access via its absolute path bypassed the copy-on-write overlay and wrote directly to the game folder, violating the invariant that the game folder is never modified.

classify_with now verifies whether a UNC path falls within game_root_lc, data_root_lc, or own_roots_lc before letting external UNC paths pass through.

Fixes #961.

What is in it

  • crates/xcl/src/vfs.rs: in classify_with, check whether a \\\\-prefixed path matches game_root_lc, data_root_lc, or own_roots_lc before early-returning Target::Pass.
  • crates/xcl/src/vfs.rs: added unit test unc_game_root_protects_game_folder_from_writes verifying that paths inside a UNC game root classify as Target::Game while external UNC paths classify as Target::Pass.

Tested

  • Windows 11 x64, Rust 1.98.1
  • Injected unit test unc_game_root_protects_game_folder_from_writes: fails with Target::Pass without the fix, and passes returning Target::Game { rel: save.dat } with the fix.
  • Full-suite run on NVIDIA GeForce RTX 5070 Ti (courtesy of @⁠futurepro62): XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 736 passed, 0 failed, 41 ignored.

Regression run

  • RTX 3060 12 GB (581.80), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s (courtesy of @⁠Anon64).

main:

xcl-smoke v1
commit: 67a3735177f42cf8e5c886e67a974da7f87541b3
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1502 (PresentX 1502)
presents per 2 s (last 3): 45 8 2
device removals: 0
crashes: 0
peak commit: 25405 MB

this PR:

xcl-smoke v1
commit: b028903ed838bcc1ac669dc2045fc177939aab06
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1460 (PresentX 1460)
presents per 2 s (last 3): 46 19 0
device removals: 0
crashes: 0
peak commit: 24570 MB

Not tested

  • Live network share mounting over SMB (tested using injected synthetic path resolution).
  • The retail title runs from a local drive, so the UNC game-root path is not reached in retail smoke.

AI use

  • Antigravity with Gemini 3.8 Flash investigated the issue, wrote the fix and unit test, and drafted this PR.
**@⁠mahfuzinam0045-spec** on GitHub · 2026-11-24 11:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1077) `mahfuzinam0045-spec:fix/vfs-unc-game-root` → `main` · +34 −1 · 1 files · 1 commits · open `Vfs::classify_with` unconditionally returned `Target::Pass` for any path starting with `\\\\` before comparing the path with the game root. When the game root is hosted on a UNC network share (`\\\\server\\share\\Game`), any title access via its absolute path bypassed the copy-on-write overlay and wrote directly to the game folder, violating the invariant that the game folder is never modified. `classify_with` now verifies whether a UNC path falls within `game_root_lc`, `data_root_lc`, or `own_roots_lc` before letting external UNC paths pass through. Fixes #961. **What is in it** - `crates/xcl/src/vfs.rs`: in `classify_with`, check whether a `\\\\`-prefixed path matches `game_root_lc`, `data_root_lc`, or `own_roots_lc` before early-returning `Target::Pass`. - `crates/xcl/src/vfs.rs`: added unit test `unc_game_root_protects_game_folder_from_writes` verifying that paths inside a UNC game root classify as `Target::Game` while external UNC paths classify as `Target::Pass`. **Tested** - Windows 11 x64, Rust 1.98.1 - Injected unit test `unc_game_root_protects_game_folder_from_writes`: fails with `Target::Pass` without the fix, and passes returning `Target::Game { rel: save.dat }` with the fix. - Full-suite run on NVIDIA GeForce RTX 5070 Ti (courtesy of @⁠futurepro62): `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: 736 passed, 0 failed, 41 ignored. **Regression run** - RTX 3060 12 GB (581.80), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s (courtesy of @⁠Anon64). main: ``` xcl-smoke v1 commit: 67a3735177f42cf8e5c886e67a974da7f87541b3 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1502 (PresentX 1502) presents per 2 s (last 3): 45 8 2 device removals: 0 crashes: 0 peak commit: 25405 MB ``` this PR: ``` xcl-smoke v1 commit: b028903ed838bcc1ac669dc2045fc177939aab06 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1460 (PresentX 1460) presents per 2 s (last 3): 46 19 0 device removals: 0 crashes: 0 peak commit: 24570 MB ``` **Not tested** - Live network share mounting over SMB (tested using injected synthetic path resolution). - The retail title runs from a local drive, so the UNC game-root path is not reached in retail smoke. **AI use** - Antigravity with Gemini 3.8 Flash investigated the issue, wrote the fix and unit test, and drafted this PR.
classify_with unconditionally returned Target::Pass for any path
starting with \, which bypassed the overlay and wrote directly to
the game folder when the game root was hosted on a UNC network share
(\\server\share\Game).

Check whether a UNC path falls within the game root or XCL's own folders
before passing external UNC paths through.

Fixes #961.
Assisted-by: Antigravity (Gemini 3.8 Flash)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:39 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 11:32 UTC · original

Regression run for Regression run, scripts/smoke.ps1 on a retail title, 60 s each: this PR's head b028903 and the main it is based on (67a3735, the merge base), release builds, RTX 3060 12 GB (581.80), Windows 11 26200, XCL_NETWORK=0, A pressed every 4 s from 20 s (XCL_PRESS_A_AT).

main:

xcl-smoke v1
commit: 67a3735177f42cf8e5c886e67a974da7f87541b3
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1502 (PresentX 1502)
presents per 2 s (last 3): 45 8 2
device removals: 0
crashes: 0
peak commit: 25405 MB

this PR:

xcl-smoke v1
commit: b028903ed838bcc1ac669dc2045fc177939aab06
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1460 (PresentX 1460)
presents per 2 s (last 3): 46 19 0
device removals: 0
crashes: 0
peak commit: 24570 MB

No device removals or crashes; 97 % of main's frames, 97 % of its peak commit. Both runs reach world loading, where frames fall off the same way on this card.

Not tested: the title runs from a local drive, so the UNC game-root path this PR changes is not reached; this is a regression check only.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 11:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/1077#issuecomment-7130223814) Regression run for **Regression run**, `scripts/smoke.ps1` on a retail title, 60 s each: this PR's head `b028903` and the `main` it is based on (`67a3735`, the merge base), release builds, RTX 3060 12 GB (581.80), Windows 11 26200, `XCL_NETWORK=0`, A pressed every 4 s from 20 s (`XCL_PRESS_A_AT`). main: ``` xcl-smoke v1 commit: 67a3735177f42cf8e5c886e67a974da7f87541b3 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1502 (PresentX 1502) presents per 2 s (last 3): 45 8 2 device removals: 0 crashes: 0 peak commit: 25405 MB ``` this PR: ``` xcl-smoke v1 commit: b028903ed838bcc1ac669dc2045fc177939aab06 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1460 (PresentX 1460) presents per 2 s (last 3): 46 19 0 device removals: 0 crashes: 0 peak commit: 24570 MB ``` No device removals or crashes; 97 % of main's frames, 97 % of its peak commit. Both runs reach world loading, where frames fall off the same way on this card. **Not tested:** the title runs from a local drive, so the UNC game-root path this PR changes is not reached; this is a regression check only. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 14:25 UTC · original

Full-suite run, since this PR has no test report yet. Tested exact head b028903 (on its base 67a3735).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 736 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: unc_game_root_protects_game_folder_from_writes.

Not tested

  • AMD, a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 14:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1077#issuecomment-7134342629) Full-suite run, since this PR has no test report yet. Tested exact head `b028903` (on its base `67a3735`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **736 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `unc_game_root_protects_game_folder_from_writes`. **Not tested** - AMD, a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 08:51 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 08:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1077#issuecomment-7157556398) 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 pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1077/head:github-bot/gh-1077'
git switch 'github-bot/gh-1077'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1077'
git switch 'github-bot/gh-1077'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1077'
git switch 'github-bot/gh-1077'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1077'
git switch 'main'
git merge --squash 'github-bot/gh-1077'
git switch 'main'
git merge --ff-only 'github-bot/gh-1077'
git switch 'main'
git merge 'github-bot/gh-1077'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.