Skip to content

VFS: reject creation beneath existing virtual files - #618

Draft
WebIdentity1 wants to merge 1 commit into
xcl-dev:mainfrom
WebIdentity1:codex/vfs-file-parent-validation
Draft

WebIdentity1 wants to merge 1 commit into
xcl-dev:mainfrom
WebIdentity1:codex/vfs-file-parent-validation

Conversation

@WebIdentity1

@WebIdentity1 WebIdentity1 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Creating a file or directory below an original game file could create overlay directories that hide that file. Check visible ancestors before either operation changes the overlay, and return ERROR_PATH_NOT_FOUND for a file parent. Existing automatic creation of missing directories and replacement of deleted originals are preserved.

Part of #577, item 2 only. Item 1 is being investigated by fladit123; item 3 is outside this patch. #316 changes classification in the same file; its current diff applies cleanly to this branch, but that combined tree was not executed.

Current integration status (November24)
#1259 adds an immediate-parent directory check to prepare_write, overlapping this PR's file-creation protection but deliberately leaving create_dir unchanged. It also rejects missing/removed parents, whereas this patch preserves the old automatic-parent policy and tests it. Do not combine the patches mechanically: reconcile that policy/test interaction first. No integrated result is claimed. Existing branches and evidence are preserved.

What is in it

  • vfs.rs: parent-type check in prepare_write and create_dir, with three synthetic regression tests. README documents the refusal.

Tested

  • Head c741a2a85cc3527a4e15a457d791762dee67f0ef, base cb868b200517d7b11bbfcb0146bf0c787ce632b6. Windows 10 build 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 plus AMD integrated graphics driver 32.0.21030.2001, Rust 1.98.1 MSVC, SDK DXC 1.8.2502.11, Agility 1.620.2, debug. Desktop session, XCL_ADAPTER=3090; some upstream fixtures select AMD directly.
  • cargo build --locked --workspace: succeeded for both trees. Candidate cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: 687 passed, 1 failed, 41 ignored. Only gpu_clamp_and_omod_per_instruction failed, also present on the baseline.
  • Baseline four-thread attempt timed out after 180 s, with gpu_uma_import_check_at_init, large_heaps_get_shared_pages_as_used, slots_copy_and_release, and copy_descriptors_remaps_xbox_extra_cbv_srv_uav_to_pc_enum stalled. Baseline diagnostic with --test-threads=1: 684 passed, 1 failed, 41 ignored, same CLAMP failure. This patch is not claimed to fix the intermittent parallel stall.
  • Four explicit skips in each completed run: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no native wave64 on NVIDIA); test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state (debug layer unavailable). Unset XCL_SAMPLE_* cases return early.
  • cargo test --locked -p xcl --lib vfs::tests:: -- --test-threads=4 --show-output: old runtime plus the new tests 10/3/0; candidate 12/1/0. Both new rejection tests fail before the fix and pass after; native Win32 rejects with error 3. The third test preserves missing/deleted-parent behavior. The remaining focused failure is the existing truncate_existing_validation_errors (127 vs 5), present in both trees; it passes in the completed full-suite runs. Its first under_wine() call precedes GetLastError() and can overwrite the error.

Regression run
Independent contributor Anon64 supplied these exact-head/main runs, copied verbatim. These are their measurements, not ours. RTX3060 12GB driver581.80, i9-14900KF, Windows11 26200.9974, Rust1.90.0, release; same title/duration, clean source, scripts/smoke.ps1. They did not test whether that title writes below a game file; our synthetic tests cover the error path.

xcl-smoke v1
commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14564 MB
xcl-smoke v1
commit: c741a2a85cc3527a4e15a457d791762dee67f0ef
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14563 MB

Draft retained: conflicts with current main and required CI remains outstanding. The code/head is unchanged; these runs do not qualify any future refresh.

Not tested
By us: retail behavior, release builds, Wine, concurrent namespace changes, or a combined tree with #316. The independent startup smoke above is not direct validation of the changed error path. No claim of the retail title gameplay progress.

AI use
Codex (GPT-6) inspected the issue and overlap, implemented the patch and synthetic tests, ran native Windows validation, and prepared this description.

Creating overlay parents below a visible original file could hide that
file behind a directory. Check ancestor types before either write
preparation or directory creation mutates the overlay.

Compare rejection with native CreateFileW/CreateDirectoryW and preserve
creation below missing or deleted parents. Part of xcl-dev#577 (item 2 only).
@Anon64

Anon64 commented Nov 24, 2026

Copy link
Copy Markdown

Regression runs for this PR's head c741a2a and for its base main cb868b2, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14564 MB

this PR:

xcl-smoke v1
commit: c741a2a85cc3527a4e15a457d791762dee67f0ef
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14563 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0

Not tested

  • the unit tests on this machine
  • whether the title writes below a game file; this is a regression check only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

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.

3 participants