kernelx: LOAD_LIBRARY_AS_DATAFILE honors the VFS mount and whiteouts #1770

Open
Luislariosss wants to merge 1 commit from upstream-pr/1780 into main
Luislariosss commented 2026-11-24 20:36:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Luislariosss on 2026-11-24T20:36:11Z.


LoadLibraryExW with LOAD_LIBRARY_AS_DATAFILE reached the host copy of a game file even when the VFS had a whiteout for it, and a console path with no source left a path error instead of ERROR_FILE_NOT_FOUND.

What is in it

  • load_as_data delegates to a new load_as_data_in(vfs, ...), which resolves through the VFS first: a visible file loads from its source (console path and host path alike); a whited-out file fails with ERROR_FILE_NOT_FOUND before the host fallback is reached.
  • Test load_library_ex_as_data_respects_vfs_mount_and_whiteouts: a DLL in the game folder loads through both the console path and the host path; after delete_file whites it out, both paths fail with ERROR_FILE_NOT_FOUND.

Tested

  • Windows 11 26200, AMD Radeon RX 9060 XT 16 GB (driver 32.0.32015.7029), Ryzen 5 9600X, 16 GB RAM; Rust 1.99 stable-x86_64-pc-windows-msvc; DXC 1.9.2609.5 through XCL_DXC_DIR; CARGO_PROFILE_TEST_DEBUG=0.
  • cargo test -p xcl --lib kernelx at the head: 37 passed, 0 failed, 1 ignored. The new test fails without the fix.
  • Workspace suite at the head (cargo build --workspace then cargo test --workspace --no-fail-fast -- --test-threads=4): 876 passed, 0 failed, 38 ignored (20 test binaries; SKIPPED: pso_measurement_compiles_an_exact_synthetic_record — cannot disable the driver cache; heap_window_out_of_memory_falls_back_to_the_switch_form — no heap windows).
  • Regression run (retail title, 60 s, machine idle; the XCL process ran under a Job Object per-process committed-memory cap of 20,480 MB as in #1566 — this machine has 16 GB RAM; the blocks' title: line reads retail-title, the folder name is withheld):

main (85e3826, clean tree):

xcl-smoke v1
commit: 85e38262ff94aecd75d6f83fa8156a8b7697bd13
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 938 (PresentX 938)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15565 MB

head (0c65342, clean tree):

xcl-smoke v1
commit: 0c65342d87d6355b431b75bb1f17ef489830c9ea
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 948 (PresentX 948)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15553 MB

Not tested

  • Whether any retail title loads a whited-out file as data in normal play; the new test covers the path directly.

AI use

  • opencode: HY4 Flash Free (builds, test and smoke runs, PR assembly); review gate by Gemini 4 Neon (Antigravity). The smoke blocks and test counts are script-generated.
<!-- greyfinch-sync:ivall/xcl:issue:5479908044 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780). Originally posted by [Luislariosss](https://github.com/Luislariosss) on 2026-11-24T20:36:11Z. --- `LoadLibraryExW` with `LOAD_LIBRARY_AS_DATAFILE` reached the host copy of a game file even when the VFS had a whiteout for it, and a console path with no source left a path error instead of `ERROR_FILE_NOT_FOUND`. **What is in it** - `load_as_data` delegates to a new `load_as_data_in(vfs, ...)`, which resolves through the VFS first: a visible file loads from its source (console path and host path alike); a whited-out file fails with `ERROR_FILE_NOT_FOUND` before the host fallback is reached. - Test `load_library_ex_as_data_respects_vfs_mount_and_whiteouts`: a DLL in the game folder loads through both the console path and the host path; after `delete_file` whites it out, both paths fail with `ERROR_FILE_NOT_FOUND`. **Tested** - Windows 11 26200, AMD Radeon RX 9060 XT 16 GB (driver 32.0.32015.7029), Ryzen 5 9600X, 16 GB RAM; Rust 1.99 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2609.5 through `XCL_DXC_DIR`; `CARGO_PROFILE_TEST_DEBUG=0`. - `cargo test -p xcl --lib kernelx` at the head: 37 passed, 0 failed, 1 ignored. The new test fails without the fix. - Workspace suite at the head (`cargo build --workspace` then `cargo test --workspace --no-fail-fast -- --test-threads=4`): **876 passed, 0 failed, 38 ignored** (20 test binaries; `SKIPPED`: `pso_measurement_compiles_an_exact_synthetic_record` — cannot disable the driver cache; `heap_window_out_of_memory_falls_back_to_the_switch_form` — no heap windows). - **Regression run** (retail title, 60 s, machine idle; the XCL process ran under a Job Object per-process committed-memory cap of 20,480 MB as in #1566 — this machine has 16 GB RAM; the blocks' `title:` line reads `retail-title`, the folder name is withheld): main (`85e3826`, clean tree): ``` xcl-smoke v1 commit: 85e38262ff94aecd75d6f83fa8156a8b7697bd13 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 938 (PresentX 938) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15565 MB ``` head (`0c65342`, clean tree): ``` xcl-smoke v1 commit: 0c65342d87d6355b431b75bb1f17ef489830c9ea gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 948 (PresentX 948) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 15553 MB ``` **Not tested** - Whether any retail title loads a whited-out file as data in normal play; the new test covers the path directly. **AI use** - opencode: HY4 Flash Free (builds, test and smoke runs, PR assembly); review gate by Gemini 4 Neon (Antigravity). The smoke blocks and test counts are script-generated.
frenziedcoder commented 2026-11-24 21:09:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by frenziedcoder on 2026-11-24T20:55:49Z.


NVIDIA test report for 0c65342: an NVIDIA run next to the RX 9060 XT one in the description. Full suite green, the PR's own test passing, and a clean smoke pair (1654 vs 1654 frames).

Tested

  • NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head 0c65342d87d6355b431b75bb1f17ef489830c9ea, no local changes.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug): 876 passed, 0 failed, 42 ignored; load_library_ex_as_data_respects_vfs_mount_and_whiteouts passes. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

Regression run (scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen; XCL_PSO_PRELOAD=0 for both builds, because this machine's preload list holds the program of #1307)

base (4178e88, this PR's base; the same base run as in my report on #1747):

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 5080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14604 MB

this PR:

xcl-smoke v1
commit: 0c65342d87d6355b431b75bb1f17ef489830c9ea
gpu: NVIDIA GeForce RTX 5080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14475 MB

Not tested: a title loading a whited-out file as a data DLL; the world load; AMD.

AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.

<!-- greyfinch-sync:ivall/xcl:comment:7144245773 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780#issuecomment-7144245773). Originally posted by [frenziedcoder](https://github.com/frenziedcoder) on 2026-11-24T20:55:49Z. --- **NVIDIA test report for `0c65342`: an NVIDIA run next to the RX 9060 XT one in the description. Full suite green, the PR's own test passing, and a clean smoke pair (1654 vs 1654 frames).** **Tested** - NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 `stable-x86_64-pc-windows-msvc`, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head `0c65342d87d6355b431b75bb1f17ef489830c9ea`, no local changes. - `cargo build --workspace && cargo test --workspace -- --test-threads=4` (debug): **876 passed, 0 failed, 42 ignored**; `load_library_ex_as_data_respects_vfs_mount_and_whiteouts` passes. SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). **Regression run** (`scripts/smoke.ps1 -Seconds 60`, release, the retail title of #505 at its start screen; `XCL_PSO_PRELOAD=0` for both builds, because this machine's preload list holds the program of #1307) base (`4178e88`, this PR's base; the same base run as in my report on #1747): ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: NVIDIA GeForce RTX 5080 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14604 MB ``` this PR: ``` xcl-smoke v1 commit: 0c65342d87d6355b431b75bb1f17ef489830c9ea gpu: NVIDIA GeForce RTX 5080 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14475 MB ``` **Not tested:** a title loading a whited-out file as a data DLL; the world load; AMD. *AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.*
DavidM1911 commented 2026-11-25 00:08:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T23:35:58Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7147583648 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780#issuecomment-7147583648). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T23:35:58Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
upipibi commented 2026-11-26 21:01:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T21:01:50Z.


Head 0c65342d87d6355b431b75bb1f17ef489830c9ea, merge-base 85e38262ff94aecd75d6f83fa8156a8b7697bd13. Windows 11 Pro 26100, rustc 1.100.0 MSVC, debug, CPU only (no GPU opened). One-file fix in kernelx.rs: LOAD_LIBRARY_AS_DATAFILE now resolves through the VFS, so a whited-out file gives ERROR_FILE_NOT_FOUND.

cargo test -p xcl --lib kernelx:: -- --test-threads=1: head 36 passed, 0 failed, 1 ignored; merge-base 35 passed, 0 failed, 1 ignored. The new test passes alone on head; it calls the new load_as_data_in, so it does not build on base.

AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).

<!-- greyfinch-sync:ivall/xcl:comment:7203313160 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780#issuecomment-7203313160). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T21:01:50Z. --- Head `0c65342d87d6355b431b75bb1f17ef489830c9ea`, merge-base `85e38262ff94aecd75d6f83fa8156a8b7697bd13`. Windows 11 Pro 26100, rustc 1.100.0 MSVC, debug, CPU only (no GPU opened). One-file fix in `kernelx.rs`: `LOAD_LIBRARY_AS_DATAFILE` now resolves through the VFS, so a whited-out file gives `ERROR_FILE_NOT_FOUND`. `cargo test -p xcl --lib kernelx:: -- --test-threads=1`: head 36 passed, 0 failed, 1 ignored; merge-base 35 passed, 0 failed, 1 ignored. The new test passes alone on head; it calls the new `load_as_data_in`, so it does not build on base. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
github-actions[bot] commented 2026-12-01 02:35:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:35:39Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298783855 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780#issuecomment-7298783855). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:35:39Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:46:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:46:14Z.


Triage (#1607) – head 0c65342

No open or merged PR makes the same change. On main, load_as_data still falls back to the host path when real_path_for_read returns None (a whiteout), so a deleted game file still loads from the game folder.
No problems found in the diff. The mount was already honoured on main; the fix is the whiteout case.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303250310 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780#issuecomment-7303250310). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:46:14Z. --- **Triage (#1607)** – head 0c65342 No open or merged PR makes the same change. On main, `load_as_data` still falls back to the host path when `real_path_for_read` returns None (a whiteout), so a deleted game file still loads from the game folder. No problems found in the diff. The mount was already honoured on main; the fix is the whiteout case. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
fromthemoonx commented 2026-12-02 20:22:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T20:22:31Z.


merge-check
base: 5ad98adbc3
head: 0c65342d87
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3006 passed, 0 failed, 52 ignored (3004 / 0 / 52 on 817eb1f, plus this PR's test and 1 that main gained since); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: none. This is the second run. In the first, the lib test binary ended with 0xc0000005 while it was writing thread dumps, before this PR's test ran. That matches #3586, which happens on main too.
review: read the whole diff (1 file, +52 -1). No blocking findings. Main still loads a file the title deleted.

  1. The risk I looked for: a name the VFS does not know now failing instead of going to Windows. It does not happen. real_path_for_read returns nothing only for a file the title deleted (a whiteout).
  2. I tried 15 kinds of name with LOAD_LIBRARY_AS_DATAFILE, with main's lookup and with this PR's: system DLLs by name and by path, game DLLs by console, host and relative path, missing files, an unmounted drive, an empty name. With nothing deleted, all 15 gave the same result in both. With the game folder as the working folder and data/res.dll deleted by the title:
name main this PR
host path loads error 2
host path with forward slashes loads error 2
relative path loads error 2
relative path starting with a dot loads error 2
console path error 2 error 2
console path without the extension (res for res.dll) loads loads

The other 9 names were the same in both.
3) Not blocking: the last row is a gap that stays. Windows adds .dll after the VFS has looked up res, so the deleted file is still found.
4) Not from this PR: with the game folder as the working folder, version.dll by its bare name gives error 2 on main too, because the VFS turns it into a path in the game folder and the system folder is never searched.
5) This head shows only the PR description check. Build and test (Windows, no GPU) has not run on it, so it needs a CI run before the merge. It builds and passes here.
6) Not tested: a retail title (none on this machine).
performance: none
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ivall/xcl:comment:7357636231 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1780#issuecomment-7357636231). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-02T20:22:31Z. --- merge-check base: 5ad98adbc360225ac8a57ad9661e16fe8df9d8dd head: 0c65342d87d6355b431b75bb1f17ef489830c9ea merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3006 passed, 0 failed, 52 ignored (3004 / 0 / 52 on 817eb1f, plus this PR's test and 1 that main gained since); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps); failing: none. This is the second run. In the first, the lib test binary ended with 0xc0000005 while it was writing thread dumps, before this PR's test ran. That matches #3586, which happens on main too. review: read the whole diff (1 file, +52 -1). No blocking findings. Main still loads a file the title deleted. 1) The risk I looked for: a name the VFS does not know now failing instead of going to Windows. It does not happen. `real_path_for_read` returns nothing only for a file the title deleted (a whiteout). 2) I tried 15 kinds of name with `LOAD_LIBRARY_AS_DATAFILE`, with main's lookup and with this PR's: system DLLs by name and by path, game DLLs by console, host and relative path, missing files, an unmounted drive, an empty name. With nothing deleted, all 15 gave the same result in both. With the game folder as the working folder and `data/res.dll` deleted by the title: | name | main | this PR | |---|---|---| | host path | loads | error 2 | | host path with forward slashes | loads | error 2 | | relative path | loads | error 2 | | relative path starting with a dot | loads | error 2 | | console path | error 2 | error 2 | | console path without the extension (`res` for `res.dll`) | loads | **loads** | The other 9 names were the same in both. 3) Not blocking: the last row is a gap that stays. Windows adds `.dll` after the VFS has looked up `res`, so the deleted file is still found. 4) Not from this PR: with the game folder as the working folder, `version.dll` by its bare name gives error 2 on main too, because the VFS turns it into a path in the game folder and the system folder is never searched. 5) This head shows only the `PR description` check. `Build and test (Windows, no GPU)` has not run on it, so it needs a CI run before the merge. It builds and passes here. 6) Not tested: a retail title (none on this machine). performance: none verdict: safe to merge hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1780:upstream-pr/1780'
git switch 'upstream-pr/1780'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1780'
git switch 'upstream-pr/1780'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1780'
git switch 'upstream-pr/1780'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1780'
git switch 'main'
git merge --squash 'upstream-pr/1780'
git switch 'main'
git merge --ff-only 'upstream-pr/1780'
git switch 'main'
git merge 'upstream-pr/1780'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1770
No description provided.