VFS: treat a MAXIMUM_ALLOWED open as a write open (#2682) #2708

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

@⁠kotekompotek on GitHub · 2026-11-26 07:54 UTC · original
kotekompotek:fix/vfs-maximum-allowed → main · +21 −0 · 1 files · 1 commits · open

Fixes #2682.

WRITE_ACCESS lacks MAXIMUM_ALLOWED (0x0200_0000), so is_write takes the read branch for CreateFileW(GAME:\file, MAXIMUM_ALLOWED, ..., OPEN_EXISTING): open_decision_for returns the original path and hk_create_file_w runs the real open on it with every right the ACL grants - on a writable game folder that includes write, so a WriteFile on the handle changes the game folder the README promises is never modified, bypassing the overlay.

With the bit in the mask the open takes the same copy-on-write path as an explicit write open; a title that only wants to read gets the overlay copy instead, same content.

What is in it

  • crates/xcl/src/vfs.rs: MAXIMUM_ALLOWED in WRITE_ACCESS; a unit test asserting a MAXIMUM_ALLOWED + OPEN_EXISTING open of a game file gets the overlay copy while a plain GENERIC_READ open still gets the original.

Tested

  • NVIDIA GeForce GTX 1050 (SM 6.5 max), Windows 11, Rust stable MSVC.
  • cargo test -p xcl --lib a_maximum_allowed_open_takes_the_write_path: fails without the fix (the original path is returned), passes with it.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 15393dc5 (parent b49be183, which merges cleanly): 1433 passed / 3 failed / 47 ignored, 357 GPU tests SKIPPED. The 3 failures are the known environment-bound ones (SM 6.5 / driver HRESULT / DXC barrier diff), same set as upstream b49be183.

Regression run

Run under load-matched conditions on D:\GTA6.Xbox.v1.0.2.1, -Seconds 0 (the only window that reliably precedes the title's entry-point int3 on this hardware), both binaries release-built.

Main b49be183:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce GTX 1050
title: 9cc6a39e
seconds: 0
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 902 MB

PR head 15393dc5:

xcl-smoke v1
commit: 15393dc5547d9c721cf3c09a8b8107ed0d1786ac
gpu: NVIDIA GeForce GTX 1050
title: 9cc6a39e
seconds: 0
exit: 0x0
frames shown: 0 (PresentX 0)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 896 MB

Not tested

  • A real title that opens game files with MAXIMUM_ALLOWED (the issue rates it rare); verified on the synthetic decision only.
  • The 3 environment-bound GPU tests that fail on this machine (the GPU caps at SM 6.5); community members verify them on SM 6.6 cards.

AI use

Devin (SWE-2 High) implemented the fix and test, ran the suite and smoke runs, and wrote this PR.

**@⁠kotekompotek** on GitHub · 2026-11-26 07:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2708) `kotekompotek:fix/vfs-maximum-allowed` → `main` · +21 −0 · 1 files · 1 commits · open Fixes #2682. `WRITE_ACCESS` lacks `MAXIMUM_ALLOWED` (0x0200_0000), so `is_write` takes the read branch for `CreateFileW(GAME:\file, MAXIMUM_ALLOWED, ..., OPEN_EXISTING)`: `open_decision_for` returns the original path and `hk_create_file_w` runs the real open on it with every right the ACL grants - on a writable game folder that includes write, so a `WriteFile` on the handle changes the game folder the README promises is never modified, bypassing the overlay. With the bit in the mask the open takes the same copy-on-write path as an explicit write open; a title that only wants to read gets the overlay copy instead, same content. **What is in it** - `crates/xcl/src/vfs.rs`: `MAXIMUM_ALLOWED` in `WRITE_ACCESS`; a unit test asserting a `MAXIMUM_ALLOWED + OPEN_EXISTING` open of a game file gets the overlay copy while a plain `GENERIC_READ` open still gets the original. **Tested** - NVIDIA GeForce GTX 1050 (SM 6.5 max), Windows 11, Rust stable MSVC. - `cargo test -p xcl --lib a_maximum_allowed_open_takes_the_write_path`: fails without the fix (the original path is returned), passes with it. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `15393dc5` (parent `b49be183`, which merges cleanly): 1433 passed / 3 failed / 47 ignored, 357 GPU tests SKIPPED. The 3 failures are the known environment-bound ones (SM 6.5 / driver HRESULT / DXC barrier diff), same set as upstream `b49be183`. **Regression run** Run under load-matched conditions on `D:\GTA6.Xbox.v1.0.2.1`, `-Seconds 0` (the only window that reliably precedes the title's entry-point int3 on this hardware), both binaries release-built. Main `b49be183`: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce GTX 1050 title: 9cc6a39e seconds: 0 exit: 0x0 frames shown: 0 (PresentX 0) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 902 MB ``` PR head `15393dc5`: ``` xcl-smoke v1 commit: 15393dc5547d9c721cf3c09a8b8107ed0d1786ac gpu: NVIDIA GeForce GTX 1050 title: 9cc6a39e seconds: 0 exit: 0x0 frames shown: 0 (PresentX 0) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 896 MB ``` **Not tested** - A real title that opens game files with `MAXIMUM_ALLOWED` (the issue rates it rare); verified on the synthetic decision only. - The 3 environment-bound GPU tests that fail on this machine (the GPU caps at SM 6.5); community members verify them on SM 6.6 cards. **AI use** Devin (SWE-2 High) implemented the fix and test, ran the suite and smoke runs, and wrote this PR.
MAXIMUM_ALLOWED asks for every right the ACL grants - on a writable game
folder that includes write, but WRITE_ACCESS lacked the bit, so
CreateFileW(GAME:\file, MAXIMUM_ALLOWED, OPEN_EXISTING) took the read
branch of open_decision_for and the real open ran on the original with
whatever rights the ACL gave. A WriteFile on that handle changed the
game folder, bypassing the overlay the README promises is never
modified. With the bit in the mask the open goes to the overlay copy,
the same as an explicit write open.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:58:12 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-26 08:04 UTC · original

This is the same change as #2694 (opened about an hour earlier for #2682): both add MAXIMUM_ALLOWED (0x0200_0000) to WRITE_ACCESS in crates/xcl/src/vfs.rs and add one open_decision test. You may want to agree with @⁠luckyteagirl on which one to keep. The question on #2694 about the copy-on-open cost for large archives opened with MAXIMUM_ALLOWED applies to this one as well.

AI use: Claude Code (Claude Opus 5.5) compared the two diffs and wrote this comment.

**@⁠fromthemoonx** on GitHub · 2026-11-26 08:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2708#issuecomment-7186153863) This is the same change as #2694 (opened about an hour earlier for #2682): both add `MAXIMUM_ALLOWED` (`0x0200_0000`) to `WRITE_ACCESS` in `crates/xcl/src/vfs.rs` and add one `open_decision` test. You may want to agree with @⁠luckyteagirl on which one to keep. The question on #2694 about the copy-on-open cost for large archives opened with `MAXIMUM_ALLOWED` applies to this one as well. AI use: Claude Code (Claude Opus 5.5) compared the two diffs and wrote this comment.
Author
Owner

@⁠sage-sage on GitHub · 2026-11-26 08:48 UTC · original

Test report: passes on NVIDIA. Exact head 15393dc5 (its base is current main b49be18, so head = merged).

Tested

  • RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build
  • cargo test --workspace -- --test-threads=4: 1436 passed, 0 failed, 47 ignored; a_maximum_allowed_open_takes_the_write_path passes
  • SKIPPED: 29 lines, the same as on main on this machine (wave64, debug layer, Developer Mode, heap windows)
  • With the MAXIMUM_ALLOWED line taken out of WRITE_ACCESS (local only): the new test fails at vfs.rs:857 (the open is not sent to the overlay), so it covers the fix.

Not tested

  • No game, so not a title opening its files with MAXIMUM_ALLOWED.

Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

**@⁠sage-sage** on GitHub · 2026-11-26 08:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/2708#issuecomment-7187050263) **Test report: passes on NVIDIA.** Exact head `15393dc5` (its base is current `main` `b49be18`, so head = merged). **Tested** - RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build - `cargo test --workspace -- --test-threads=4`: 1436 passed, 0 failed, 47 ignored; `a_maximum_allowed_open_takes_the_write_path` passes - SKIPPED: 29 lines, the same as on `main` on this machine (wave64, debug layer, Developer Mode, heap windows) - With the `MAXIMUM_ALLOWED` line taken out of `WRITE_ACCESS` (local only): the new test fails at `vfs.rs:857` (the open is not sent to the overlay), so it covers the fix. **Not tested** - No game, so not a title opening its files with `MAXIMUM_ALLOWED`. Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
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/2708/head:github-bot/gh-2708'
git switch 'github-bot/gh-2708'

Merge

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