Skip to content

VFS: route MAXIMUM_ALLOWED opens through the overlay - #2694

Open
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/vfs-maximum-allowed-overlay
Open

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/vfs-maximum-allowed-overlay

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

Regression run

  • scripts/smoke.ps1 -Game <owned title folder> -Seconds 12 through a monitored runner with XCL_ADAPTER=6800M, separate XCL data and DXIL cache directories, and clean release builds. Same title hash and duration; no guard intervention. Main showed 147 frames and 7,512 MB peak commit; the patch showed 162 frames and 7,509 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: 12
exit: 0x0
frames shown: 147 (PresentX 147)
presents per 2 s (last 3): 27 60 60
device removals: 0
crashes: 0
peak commit: 7512 MB

PR head:

xcl-smoke v1
commit: c4d013199b705fcc6dcff070e2dd687834af0ada
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 12
exit: 0x0
frames shown: 162 (PresentX 162)
presents per 2 s (last 3): 41 60 60
device removals: 0
crashes: 0
peak commit: 7509 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. Both head and clean main hit the same library access violation and warm split-driver-cache failure on this 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.

Related

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)
@luckyteagirl
luckyteagirl marked this pull request as ready for review November 26, 2026 06:47
@fromthemoonx

Copy link
Copy Markdown

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.

@luckyteagirl

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VFS: a MAXIMUM_ALLOWED open of a game file is treated as a read and bypasses the overlay

2 participants