VFS: route MAXIMUM_ALLOWED opens through the overlay #2684
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2694"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T06:42:42Z.
Fixes #2682. A title can request
MAXIMUM_ALLOWEDwithout 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
MAXIMUM_ALLOWEDin the VFS write-capable access mask.Tested
30.0.13002.13003); AMD Ryzen 9 5980HX; Rust 1.99.0 MSVC.mainby selecting the original and passed onc4d013199b705fcc6dcff070e2dd687834af0ada. All 13 VFS module tests passed on the committed head (0 failed, 0 ignored, 0 skipped) withXCL_ADAPTER=6800M,XCL_REQUIRE_GPU=1, and one test thread. These VFS tests run on the CPU.CreateFileWprobe confirmed thatMAXIMUM_ALLOWEDcan grant a writable handle when the ACL allows it.FILE_READ_DATAto this user. NativeCreateFileW(MAXIMUM_ALLOWED)still granted write rights and a scratchWriteFilesucceeded, whileCopyFileExWfailed withERROR_ACCESS_DENIED(5). A minimal harness compiled from exact currentmain83b00818and PR headc4d01319VFS sources returnedUse(original)on main andFail(5)on the PR for that open. The scratch file and its ACL were cleaned up after the probe; this was not a title run.cargo build --locked --release -p xcl -j 1passed on both cleanmainand the committed head.scripts/test.ps1completed the workspace and test-binary builds but the library harness exited with0xc0000005during the DXIL tests, before a full-suite summary. Its log shows 83okand oneignoredprogress lines before the abort; these are not complete suite counts.XCL_ADAPTER=6800MandXCL_REQUIRE_GPUunset,cargo test --locked --workspace --no-fail-fast -j 1 -- --test-threads=1 --show-outputcompleted 36 targets: 125 passed, 1 failed, 20 ignored, and 4 explicitSKIPPEDlines (two title debug-layer variants withoutd3d12SDKLayers.dll, one no heap windows, one texture-upload check without the D3D12 debug layer). The library target separately aborted with0xc0000005duringraw_loads_in_root_windows_respect_exec_and_boundsafter 85okand oneignoredprogress lines, so it has no final counts. The completed-target failure wasoffline_split_compute_pipeline_is_reused_by_a_second_process: its warm run expected five loaded driver-cache pipelines and reported zero.maincontrol,cargo test --locked -p xcl --lib -j 1 -- --test-threads=1 --show-outputwith the same RX 6800M selection, also aborted with0xc0000005in that exactraw_loads_in_root_windows_respect_exec_and_boundstest after 85okand oneignoredprogress lines.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.cargo test --workspace --no-fail-fast -- --test-threads=4completed with 1,436 passed, 0 failed, 47 ignored, and 25 explicit GPU skips. The VFS regression passed three repeated runs; a scratch mutation removingMAXIMUM_ALLOWEDfromWRITE_ACCESSmade 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 60withXCL_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 provenMAXIMUM_ALLOWEDopen.Main:
PR head:
Copy-on-open cost
MAXIMUM_ALLOWEDmay 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 withMAXIMUM_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.b49be183and PR headc4d01319, the logs each sampled 24 CreateFile calls, including six.rpfopens. Neither log recorded a redirected write, both final reports recorded zero redirected writes and whiteouts, and both fresh overlay directories remained empty. The sampled calls record creation flags, and DesiredAccess was not logged, so this evidence cannot establish whether any open requestedMAXIMUM_ALLOWED.ACL compatibility limit
MAXIMUM_ALLOWEDwrite rights while denying content read. XCL cannot make an overlay copy of that file, so this PR returns access denied where current main would open the original with a writable handle. Returning that original handle would allow modification of the game folder. This fail-closed behavior is intentional pending a different safe policy; a title that depends on this unusual ACL/open combination may be affected. The fixture above reproduces the difference; I have not observed it in a title.Not tested
MAXIMUM_ALLOWED; the regression fixture tests routing and the retail smoke checks general startup behavior.AI use
Related
is_writeand 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.Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-26T07:06:35Z.
A complete GPU workspace suite (listed under Not tested): passes on NVIDIA, and the new test fails without the
MAXIMUM_ALLOWEDbit. One question about the cost, below.Tested:
c4d0131(its base is currentmainb49be18, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.cargo test --workspace --no-fail-fast -- --test-threads=4SKIPPEDlines; the library process ran to the end (no0xc0000005here)vfs::tests::maximum_allowed_open_uses_an_overlay_copy, 3 runsMAXIMUM_ALLOWEDtaken out ofWRITE_ACCESSagainopen_decisionreturns the game folder'sdata\hello.txtinstead of the overlay pathA question about the cost: with this, an
OPEN_EXISTINGopen withMAXIMUM_ALLOWEDand 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 hasoriginalright afteropen_decision). If a title usesMAXIMUM_ALLOWEDto 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.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T07:33:50Z.
Thanks for the full GPU suite and mutation check. Yes: with the current VFS copy-on-open design,
MAXIMUM_ALLOWEDtakes 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.Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T15:30:59Z.
NVIDIA test report for
c4d0131: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(head as-is, onb49be18): 1301 passed, 0 failed, 27 ignored, and the process ran to the end (no 0xc0000005). 25 SKIPPED: 21no wave64, 3 wave32 per-lane forms the translator refuses (#1426), 1pso_measurement_compiles_an_exact_synthetic_recordwithout Developer Mode. None is invfs.rs.vfs::tests::maximum_allowed_open_uses_an_overlay_copy,--exact --test-threads=1 --nocapture, 3 runs: 3/3 passed, 0 SKIPPED (a CPU-only test).Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-27T07:07:38Z.
Cross-PR integration check on current
main83b00818: I applied this PR's exact headc4d0131, then #2634's exact heade897ce3, in a disposable worktree. Both merges were clean; the resulting local merge is1cf5f13.src/vfs.rsandsrc/log.rsmatch their respective PR heads byte for byte.On Windows 11 build 26200 with Rust 1.99.0 MSVC (debug), a fresh
cargo test --offline --locked -p xcl --lib -j 2 --no-runbuild in a dedicated target directory produced the batch test binary. Serial focused runs passed: VFS 13/13 (includingMAXIMUM_ALLOWED) and logger 3/3 (including write and flush failure cases), with 0 failures, 0 ignored, and 0 explicit skips. I checked the test binary's source/manifest, inventory, and SHA-256 before and after running it.This is integration evidence for the two unchanged PR heads, not a new full GPU workspace suite or retail title run. The independent full GPU and paired smoke results already in this PR remain the broader evidence. AI use: Codex with a GPT-6.2 Sol agent prepared and checked this local batch.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T09:03:47Z.
Independent desktop NVIDIA verification of PR #2694 at head
c4d013199b705fcc6dcff070e2dd687834af0ada(1commit; exact parent & merge-base:b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
c4d01319)cargo test --release -p xcl --lib maximum_allowed_open_uses_an_overlay_copy -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1336 filtered out× 3 (0.00s,0.01s,0.00s,0skipped)cargo test --release -p xcl --lib vfs:: -- --test-threads=1(3 consecutive runs)13 passed; 0 failed; 0 ignored; 1324 filtered out× 3 (0.04s,0.05s,0.04s,0skipped)cargo build --release -p xcl1m 40s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):PR #2694 (
c4d013199b705fcc6dcff070e2dd687834af0ada):Runtime log observations (
xcl.log)9221log lines,0[ERROR]/ device-removal / panic lines (dxil_cache:460hits,0misses,0compilation failures;228background pipelines,0failures).19456 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13992 MB committed by the process; video memory 6116 MB local, 4650 MB non-local.Limits of coverage
MAXIMUM_ALLOWEDopens through the copy-on-write overlay (leaving original files unmodified) was verified directly viamaximum_allowed_open_uses_an_overlay_copy(3/3) andvfs::(13/13× 3).title: 29640639(single-run frame/commit delta vs. cached parent reflects normal startup variance, not this PR); it did not separately audit whether this title issuesMAXIMUM_ALLOWEDopens during the 60 s window.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:55:33Z.
merge-check claim
head:
c4d013199bImported from ivall/xcl. Originally posted by throny on 2026-11-28T14:12:25Z.
merge-check
base:
e13d6250head:
c4d013199bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2131 passed, 10 failed, 48 ignored (26 SKIPPED lines). The 10 failures are the ones main itself has at
e13d6250on this GPU (#3093: the nine since #2959 and, since today, gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions), the same set with and without this PR; base alone: 2130 passed, 10 failed, 48 ignored.review: correct for what it sets out to do. An open with MAXIMUM_ALLOWED now counts as a write: on an existing game file the original is copied into the overlay and the overlay path is opened, so such an open can no longer reach the read-only game folder (before, it opened the original, where the system could grant write access). A directory opened with that mask now creates the overlay directory and records a write. A file whose access list allows writing but not reading now returns access denied where it opened the original before (said to be intended).
performance: this is on by default and has a real cost that nobody has measured: every MAXIMUM_ALLOWED open of an existing game file copies the whole file (disk space, and a stall on the calling thread), also when the caller only reads. For a large archive that is a long stall. The smoke runs in the thread did not log the access masks, so whether a retail title opens its archives this way is unknown.
verdict: safe to merge (correctness; the copy cost is the maintainer's call, and a count of such opens on a retail title would settle it)
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).
Imported from ivall/xcl. Originally posted by Parakeet-Wheat on 2026-11-30T01:15:05Z.
merge-check
base:
53e85fb124head:
c4d013199bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2792 passed, 2 failed, 49 ignored; SKIPPED: 29 (22 no wave64, 3 wave32 per-lane forms refused (#1426), 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 driver cache needs Developer Mode); failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline fails on the base alone too (5 of 5 runs on base, 5 of 5 on the merge); e2e test_title_draws_with_a_root_signature_under_the_debug_layer failed once in the full run on the D3D12.X check "a texture in title memory (XG layout, #44) follows CPU writes" (every file/overlay check in that run passed, including "writes go to the overlay, game folder untouched"); it did not reproduce alone: 3 of 3 passed on the base and 3 of 3 on the merge.
review: correct for what it sets out to do; whole diff read (16 lines, vfs.rs only). MAXIMUM_ALLOWED now counts as a write in is_write, so an open of an existing game file with that mask gets an overlay copy instead of a handle to the original, which Windows could have granted with write rights. All three open hooks (CreateFileW, CreateFileA, CreateFile2) pass the access mask unchanged, so all are covered. MAXIMUM_ALLOWED has the same value as FILE_FLAG_BACKUP_SEMANTICS (0x0200_0000), but WRITE_ACCESS is tested only against the access mask (is_write), never against the flags, so the two do not mix. The new test fails without the fix: with MAXIMUM_ALLOWED taken out of WRITE_ACCESS it returns the game folder's file instead of the overlay path; restored, it passes. As the description says, a file that grants write but denies read now fails with access denied instead of opening the original (fail-closed, intended). #2850 makes the same one-line change (no test) and is not yet in #1607's D128 group with this PR and #2708.
performance: on by default. Every MAXIMUM_ALLOWED open of an existing game file now copies the whole file into the overlay first, also when the caller only reads; for a large archive that is a stall and the disk space. Not measured here (no title run); the PR description reports an empty overlay and zero redirected writes after its 60 s smoke on the PR head.
verdict: safe to merge (the copy cost on a title that does open archives with MAXIMUM_ALLOWED is unmeasured and the maintainer's call)
hardware / tool and model: RTX 3070 8 GB (610.88), Ryzen 5 5600X, Windows 11 Home 26300, Rust 1.95.0, debug / Claude Code, Claude Opus 5.5 (merge, build, suite, reruns, mutation check and review)