VFS: route MAXIMUM_ALLOWED opens through the overlay #2694

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

@⁠luckyteagirl on GitHub · 2026-11-26 06:42 UTC · original
luckyteagirl:codex/vfs-maximum-allowed-overlay → main · +16 −0 · 1 files · 1 commits · open

Fixes #2682. A title can request MAXIMUM_ALLOWED without an explicit write bit. The old VFS classifier sent that open to the original game file even though Windows can grant write access. This change sends the request through the copy-on-write overlay.

What is in it

  • Include MAXIMUM_ALLOWED in the VFS write-capable access mask.
  • Add a fixture that opens an existing game file with only that access bit and checks that the selected path is the overlay copy while the original bytes stay intact.

Tested

  • Windows 11 Home build 26200; AMD Radeon RX 6800M (driver 30.0.13002.13003); AMD Ryzen 9 5980HX; Rust 1.99.0 MSVC.
  • The focused VFS fixture failed on clean main by selecting the original and passed on c4d013199b705fcc6dcff070e2dd687834af0ada. All 13 VFS module tests passed on the committed head (0 failed, 0 ignored, 0 skipped) with XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, and one test thread. These VFS tests run on the CPU.
  • A native Windows CreateFileW probe confirmed that MAXIMUM_ALLOWED can grant a writable handle when the ACL allows it.
  • cargo build --locked --release -p xcl -j 1 passed on both clean main and the committed head.
  • scripts/test.ps1 completed the workspace and test-binary builds but the library harness exited with 0xc0000005 during the DXIL tests, before a full-suite summary. Its log shows 83 ok and one ignored progress lines before the abort; these are not complete suite counts.
  • With XCL_ADAPTER=6800M and XCL_REQUIRE_GPU unset, cargo test --locked --workspace --no-fail-fast -j 1 -- --test-threads=1 --show-output completed 36 targets: 125 passed, 1 failed, 20 ignored, and 4 explicit SKIPPED lines (two title debug-layer variants without d3d12SDKLayers.dll, one no heap windows, one texture-upload check without the D3D12 debug layer). The library target separately aborted with 0xc0000005 during raw_loads_in_root_windows_respect_exec_and_bounds after 85 ok and one ignored progress lines, so it has no final counts. The completed-target failure was offline_split_compute_pipeline_is_reused_by_a_second_process: its warm run expected five loaded driver-cache pipelines and reported zero.
  • A clean main control, cargo test --locked -p xcl --lib -j 1 -- --test-threads=1 --show-output with the same RX 6800M selection, also aborted with 0xc0000005 in that exact raw_loads_in_root_windows_respect_exec_and_bounds test after 85 ok and one ignored progress lines.
  • A second clean-main control, cargo test --locked -p xcl --test gpu_compute_e2e -j 1 offline_split_compute_pipeline_is_reused_by_a_second_process -- --exact --test-threads=1 --nocapture, reproduced the same warm-cache assertion on this RX 6800M: 0 passed, 1 failed, 0 ignored, 0 skipped; five pieces rebuilt and zero loaded. Both workspace failures therefore also occur without this VFS patch.
  • Independent RTX 3060 report on this exact clean head: cargo test --workspace --no-fail-fast -- --test-threads=4 completed with 1,436 passed, 0 failed, 47 ignored, and 25 explicit GPU skips. The VFS regression passed three repeated runs; a scratch mutation removing MAXIMUM_ALLOWED from WRITE_ACCESS made it fail by selecting the original game file. These are the independent reporter's results, not runs on our RX 6800M.

Regression run

  • scripts/smoke.ps1 -Game <owned title folder> -Seconds 60 with XCL_ADAPTER=6800M, separate fresh XCL data and DXIL cache directories, and clean exact-head release builds. Same title hash and duration. Main showed 759 frames and 14,513 MB peak commit; the patch showed 771 frames and 14,494 MB. These runs check general startup and presentation, not a proven MAXIMUM_ALLOWED open.

Main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 60
exit: 0x0
frames shown: 759 (PresentX 759)
presents per 2 s (last 3): 57 60 60
device removals: 0
crashes: 0
peak commit: 14513 MB

PR head:

xcl-smoke v1
commit: c4d013199b705fcc6dcff070e2dd687834af0ada
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 60
exit: 0x0
frames shown: 771 (PresentX 771)
presents per 2 s (last 3): 54 60 60
device removals: 0
crashes: 0
peak commit: 14494 MB

Copy-on-open cost

  • The VFS currently makes an overlay copy before a write-capable open of an existing game file. MAXIMUM_ALLOWED may grant write rights, so this patch uses that path even if the caller only reads. A large archive opened this way can therefore be copied in full and consume matching overlay space. The title smoke did not establish whether it opens archives with MAXIMUM_ALLOWED; that workload and cost remain unmeasured. Avoiding an eager copy would need a safe way to redirect a later write without giving the title a writable handle to the original game file.

Not tested

  • A title open that actually requests MAXIMUM_ALLOWED; the regression fixture tests routing and the retail smoke checks general startup behavior.
  • A complete passing GPU workspace suite on our RX 6800M. The independent RTX 3060 suite passed with 25 explicit GPU skips. Both head and clean main hit the same library access violation and warm split-driver-cache failure on our RX 6800M; the causes were not investigated in this VFS PR.

AI use

  • Codex (GPT-6.2 Sol) implemented and tested the patch. Codex reviewed it against the issue, Windows access behavior, and neighboring PRs.
  • OpenAI Codex (GPT-6.2 Astra) verified the independent exact-head report and added its linked results to this description.

Related

  • #1092 also uses is_write and remains semantically compatible. If both PRs land, their new VFS unit tests occupy the same insertion point and may need a test-only rebase resolution.
**@⁠luckyteagirl** on GitHub · 2026-11-26 06:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2694) `luckyteagirl:codex/vfs-maximum-allowed-overlay` → `main` · +16 −0 · 1 files · 1 commits · open Fixes #2682. A title can request `MAXIMUM_ALLOWED` without an explicit write bit. The old VFS classifier sent that open to the original game file even though Windows can grant write access. This change sends the request through the copy-on-write overlay. **What is in it** - Include `MAXIMUM_ALLOWED` in the VFS write-capable access mask. - Add a fixture that opens an existing game file with only that access bit and checks that the selected path is the overlay copy while the original bytes stay intact. **Tested** - Windows 11 Home build 26200; AMD Radeon RX 6800M (driver `30.0.13002.13003`); AMD Ryzen 9 5980HX; Rust 1.99.0 MSVC. - The focused VFS fixture failed on clean `main` by selecting the original and passed on `c4d013199b705fcc6dcff070e2dd687834af0ada`. All 13 VFS module tests passed on the committed head (`0 failed, 0 ignored, 0 skipped`) with `XCL_ADAPTER=6800M`, `XCL_REQUIRE_GPU=1`, and one test thread. These VFS tests run on the CPU. - A native Windows `CreateFileW` probe confirmed that `MAXIMUM_ALLOWED` can grant a writable handle when the ACL allows it. - `cargo build --locked --release -p xcl -j 1` passed on both clean `main` and the committed head. - `scripts/test.ps1` completed the workspace and test-binary builds but the library harness exited with `0xc0000005` during the DXIL tests, before a full-suite summary. Its log shows 83 `ok` and one `ignored` progress lines before the abort; these are not complete suite counts. - With `XCL_ADAPTER=6800M` and `XCL_REQUIRE_GPU` unset, `cargo test --locked --workspace --no-fail-fast -j 1 -- --test-threads=1 --show-output` completed 36 targets: **125 passed, 1 failed, 20 ignored**, and 4 explicit `SKIPPED` lines (two title debug-layer variants without `d3d12SDKLayers.dll`, one no heap windows, one texture-upload check without the D3D12 debug layer). The library target separately aborted with `0xc0000005` during `raw_loads_in_root_windows_respect_exec_and_bounds` after 85 `ok` and one `ignored` progress lines, so it has no final counts. The completed-target failure was `offline_split_compute_pipeline_is_reused_by_a_second_process`: its warm run expected five loaded driver-cache pipelines and reported zero. - A clean `main` control, `cargo test --locked -p xcl --lib -j 1 -- --test-threads=1 --show-output` with the same RX 6800M selection, also aborted with `0xc0000005` in that exact `raw_loads_in_root_windows_respect_exec_and_bounds` test after 85 `ok` and one `ignored` progress lines. - A second clean-main control, `cargo test --locked -p xcl --test gpu_compute_e2e -j 1 offline_split_compute_pipeline_is_reused_by_a_second_process -- --exact --test-threads=1 --nocapture`, reproduced the same warm-cache assertion on this RX 6800M: **0 passed, 1 failed, 0 ignored, 0 skipped**; five pieces rebuilt and zero loaded. Both workspace failures therefore also occur without this VFS patch. - Independent [RTX 3060 report on this exact clean head](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2694): `cargo test --workspace --no-fail-fast -- --test-threads=4` completed with **1,436 passed, 0 failed, 47 ignored**, and 25 explicit GPU skips. The VFS regression passed three repeated runs; a scratch mutation removing `MAXIMUM_ALLOWED` from `WRITE_ACCESS` made it fail by selecting the original game file. These are the independent reporter's results, not runs on our RX 6800M. **Regression run** - `scripts/smoke.ps1 -Game <owned title folder> -Seconds 60` with `XCL_ADAPTER=6800M`, separate fresh XCL data and DXIL cache directories, and clean exact-head release builds. Same title hash and duration. Main showed 759 frames and 14,513 MB peak commit; the patch showed 771 frames and 14,494 MB. These runs check general startup and presentation, not a proven `MAXIMUM_ALLOWED` open. Main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 60 exit: 0x0 frames shown: 759 (PresentX 759) presents per 2 s (last 3): 57 60 60 device removals: 0 crashes: 0 peak commit: 14513 MB ``` PR head: ``` xcl-smoke v1 commit: c4d013199b705fcc6dcff070e2dd687834af0ada gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 60 exit: 0x0 frames shown: 771 (PresentX 771) presents per 2 s (last 3): 54 60 60 device removals: 0 crashes: 0 peak commit: 14494 MB ``` **Copy-on-open cost** - The VFS currently makes an overlay copy before a write-capable open of an existing game file. `MAXIMUM_ALLOWED` may grant write rights, so this patch uses that path even if the caller only reads. A large archive opened this way can therefore be copied in full and consume matching overlay space. The title smoke did not establish whether it opens archives with `MAXIMUM_ALLOWED`; that workload and cost remain unmeasured. Avoiding an eager copy would need a safe way to redirect a later write without giving the title a writable handle to the original game file. **Not tested** - A title open that actually requests `MAXIMUM_ALLOWED`; the regression fixture tests routing and the retail smoke checks general startup behavior. - A complete passing GPU workspace suite on our RX 6800M. The independent RTX 3060 suite passed with 25 explicit GPU skips. Both head and clean main hit the same library access violation and warm split-driver-cache failure on our RX 6800M; the causes were not investigated in this VFS PR. **AI use** - Codex (GPT-6.2 Sol) implemented and tested the patch. Codex reviewed it against the issue, Windows access behavior, and neighboring PRs. - OpenAI Codex (GPT-6.2 Astra) verified the independent exact-head report and added its linked results to this description. **Related** - #1092 also uses `is_write` and remains semantically compatible. If both PRs land, their new VFS unit tests occupy the same insertion point and may need a test-only rebase resolution.
Treat maximum allowed access as potentially writable so opens of original game files follow the existing copy-on-write path. Cover the routing decision using a synthetic file and verify the original bytes remain intact.

Assisted-by: Codex (GPT-6.2 Sol)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:46:53 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-26 07:06 UTC · original

A complete GPU workspace suite (listed under Not tested): passes on NVIDIA, and the new test fails without the MAXIMUM_ALLOWED bit. One question about the cost, below.

Tested: c4d0131 (its base is current main b49be18, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 1436 passed, 0 failed, 47 ignored; 25 SKIPPED lines; the library process ran to the end (no 0xc0000005 here)
vfs::tests::maximum_allowed_open_uses_an_overlay_copy, 3 runs 3 of 3
scratch: MAXIMUM_ALLOWED taken out of WRITE_ACCESS again fails: open_decision returns the game folder's data\hello.txt instead of the overlay path

A question about the cost: with this, an OPEN_EXISTING open with MAXIMUM_ALLOWED and no write bit takes the copy-on-write path, so the whole file is copied into the overlay when it is opened (the test checks the copy has original right after open_decision). If a title uses MAXIMUM_ALLOWED to open its large archives just for reading, each such file would then be copied to the data folder on its first open. Is that intended? Another option is to open the original with read rights in that case, or to copy only on the first write. I have not checked whether the retail title opens files this way.

Not tested: a title that opens files with MAXIMUM_ALLOWED, a release build, AMD.

AI use: Claude Code (Claude Opus 5.5) ran the suite and the scratch change, read open_decision, and wrote this report.

**@⁠fromthemoonx** on GitHub · 2026-11-26 07:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/2694#issuecomment-7185105165) **A complete GPU workspace suite (listed under Not tested): passes on NVIDIA, and the new test fails without the `MAXIMUM_ALLOWED` bit.** One question about the cost, below. **Tested:** `c4d0131` (its base is current `main` `b49be18`, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug. | | result | |---|---| | `cargo test --workspace --no-fail-fast -- --test-threads=4` | 1436 passed, 0 failed, 47 ignored; 25 `SKIPPED` lines; the library process ran to the end (no `0xc0000005` here) | | `vfs::tests::maximum_allowed_open_uses_an_overlay_copy`, 3 runs | 3 of 3 | | scratch: `MAXIMUM_ALLOWED` taken out of `WRITE_ACCESS` again | fails: `open_decision` returns the game folder's `data\hello.txt` instead of the overlay path | **A question about the cost:** with this, an `OPEN_EXISTING` open with `MAXIMUM_ALLOWED` and no write bit takes the copy-on-write path, so the whole file is copied into the overlay when it is opened (the test checks the copy has `original` right after `open_decision`). If a title uses `MAXIMUM_ALLOWED` to open its large archives just for reading, each such file would then be copied to the data folder on its first open. Is that intended? Another option is to open the original with read rights in that case, or to copy only on the first write. I have not checked whether the retail title opens files this way. **Not tested:** a title that opens files with `MAXIMUM_ALLOWED`, a release build, AMD. **AI use:** Claude Code (Claude Opus 5.5) ran the suite and the scratch change, read `open_decision`, and wrote this report.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 07:33 UTC · original

Thanks for the full GPU suite and mutation check. Yes: with the current VFS copy-on-open design, MAXIMUM_ALLOWED takes the write-capable path and eagerly copies an existing game file, even if this caller only reads. That preserves the game folder when Windows grants write access, but could be expensive for a large archive. My 12-second title smoke did not show whether the title uses this access mask on archives, so I have added this cost and the missing measurement to the PR description. A lazy copy would need to intercept a later write while keeping the original file unwritable through the returned handle; the current path cannot safely defer it. AI-assisted response with Codex.

**@⁠luckyteagirl** on GitHub · 2026-11-26 07:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/2694#issuecomment-7185591578) Thanks for the full GPU suite and mutation check. Yes: with the current VFS copy-on-open design, `MAXIMUM_ALLOWED` takes the write-capable path and eagerly copies an existing game file, even if this caller only reads. That preserves the game folder when Windows grants write access, but could be expensive for a large archive. My 12-second title smoke did not show whether the title uses this access mask on archives, so I have added this cost and the missing measurement to the PR description. A lazy copy would need to intercept a later write while keeping the original file unwritable through the returned handle; the current path cannot safely defer it. AI-assisted response with Codex.
This pull request can be merged automatically.
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/2694/head:github-bot/gh-2694'
git switch 'github-bot/gh-2694'

Merge

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