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

Open
mahfuzinam0045-spec wants to merge 1 commit from upstream-pr/1077 into main
mahfuzinam0045-spec commented 2026-11-24 11:22:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mahfuzinam0045-spec on 2026-11-24T11:22:04Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:5471178665 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1077). Originally posted by [mahfuzinam0045-spec](https://github.com/mahfuzinam0045-spec) on 2026-11-24T11:22:04Z. --- `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.
Anon64 commented 2026-11-24 12:05:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T11:32:13Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7130223814 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1077#issuecomment-7130223814). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-24T11:32:13Z. --- 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.
futurepro62 commented 2026-11-24 15:05:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:25:10Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7134342629 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1077#issuecomment-7134342629). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:25:10Z. --- 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.
DavidM1911 commented 2026-11-25 09:08:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:51:22Z.


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:7157556398 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1077#issuecomment-7157556398). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:51:22Z. --- 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!
github-actions[bot] commented 2026-11-29 07:40:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:40:44Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252622078 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1077#issuecomment-7252622078). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:40:44Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:46:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:46:20Z.


Triage (#1607) – head b028903

#2797 also removes the UNC early return in vfs.rs:classify_with, but it comments it out for every UNC path and also changes launcher.rs; this PR lets only UNC paths under the game, data and XCL folders through. #579 (keep the UNC path of a game on a share) is the launcher side that #961 follows up.
Note: game_root_lc is not passed through strip_verbatim in Vfs::new, so a game root given as \\?\UNC\server\share\... would not match the stripped path. The new test only uses a plain \\server\share root.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301083062 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1077#issuecomment-7301083062). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:46:20Z. --- **Triage (#1607)** – head b028903 #2797 also removes the UNC early return in vfs.rs:classify_with, but it comments it out for every UNC path and also changes launcher.rs; this PR lets only UNC paths under the game, data and XCL folders through. #579 (keep the UNC path of a game on a share) is the launcher side that #961 follows up. Note: `game_root_lc` is not passed through `strip_verbatim` in Vfs::new, so a game root given as `\\?\UNC\server\share\...` would not match the stripped path. The new test only uses a plain `\\server\share` root. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1077:upstream-pr/1077'
git switch 'upstream-pr/1077'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1077'
git switch 'upstream-pr/1077'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1077'
git switch 'upstream-pr/1077'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1077'
git switch 'main'
git merge --squash 'upstream-pr/1077'
git switch 'main'
git merge --ff-only 'upstream-pr/1077'
git switch 'main'
git merge 'upstream-pr/1077'
git push origin 'main'
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!1068
No description provided.