VFS: a MAXIMUM_ALLOWED open of a game file is treated as a read and bypasses the overlay #2682
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2682
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Kelvin19-San on GitHub · 2026-11-26 06:00 UTC · original
Title: VFS: a MAXIMUM_ALLOWED open of a game file is treated as a read and bypasses the overlay
Static read of
crates/xcl/src/vfs.rsandvfs_hooks.rsas of 2026-11-26 (commit hash not recorded; I read a copy of the files, not the current main). Not built, not run, not reproduced.What I see
WRITE_ACCESSin vfs.rs lists GENERIC_WRITE, GENERIC_ALL, FILE_WRITE_DATA, FILE_APPEND_DATA, FILE_WRITE_EA, FILE_WRITE_ATTRIBUTES, DELETE, WRITE_DAC and WRITE_OWNER.MAXIMUM_ALLOWED(0x0200_0000) is not in the mask, andVfs::is_writeonly testsaccess & WRITE_ACCESS.hk_create_file_w(vfs_hooks.rs) passes the caller'saccunchanged to the realCreateFileW, with the path chosen byopen_decision.hk_create_file_aandhk_create_file_2do the same.CreateFileW(L"GAME:\\data\\x", MAXIMUM_ALLOWED, ..., OPEN_EXISTING)takes the read branch ofopen_decision_for, getsDecision::Use(<original path>), and the real open runs on the original with every right the ACL allows. AWriteFilethrough that handle would change the game folder, which the README says is never modified.Likelihood: rare. I know of no title that opens files this way.
Suggested fix (not compiled)
Trade-off: a title that opens a large game file with
MAXIMUM_ALLOWEDonly to read it would now get a copy in the overlay, like any other write-open. If that is not wanted, the alternative is to keep it a read and open the original with the access reduced to read rights, which means rewriting the mask before the real call. I did not look at that.Suggested test (not run)
Next to
reads_never_touch_and_writes_copy_on_writein vfs.rs:Without the fix
pis the original path and the first assert fails. With it the open goes to the overlay copy.Related
The plain-read fast path in #1092 is gated by
is_write, so adding the bit toWRITE_ACCESScovers that path too.Searched first
Open and closed issues and PRs in xcl-dev/xcl for "MAXIMUM_ALLOWED" and "write access": nothing found.
AI use
Found and drafted by Claude (Claude Sonnet 5.5) from a static read of the files. The person posting has not checked the lines against the current main and has not built or run anything. Please treat it as an unconfirmed report.
github-bot referenced this issue2026-11-26 07:58:11 +00:00