DirectStorage: a virtual destination is written without faulting #705
No reviewers
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!705
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-705"
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?
@requiemsnkrp on GitHub · 2026-11-24 03:55 UTC · original
requiemsnkrp:dstorage-destination-write→main· +90 −1 · 1 files · 1 commits · openexecutechecks a virtual destination withwritable()at its start, then reads the file or copies the source and inflates it, and only then writes the destination withcopy_nonoverlapping. If the title unmapped the destination in that window (which spans the file read), the write faulted in thexcl-dstorageworker and ended the process. It is now written withwrite_own(NtWriteVirtualMemoryon the process itself), the counterpart of theread_ownthat the page arrays already use, so the request fails withE_ACCESS_VIOLATIONinstead. NotWriteProcessMemory: it first queries the region, and in the 4 GiB coherent window that took 75–175 ms a call (measured in the title: 64 KiB and 8-byte writes alike, whileReadProcessMemorytook 3–11 µs). A first version with it showed 0 frames in two 60 s regression runs, because the title's first streaming stalled. This is the destination side of #476; @brothernog found it in the review of #561. It is independent of #509 and #561 (a different hunk ofexecute), branched frommain91f9a5e.What is in it
crates/xcl/src/hle/dstorage.rs:write_own(NtWriteVirtualMemory, raw-dylib as the other ntdll calls), used for the virtual destination's write inexecute; thewritable()check at the start stays (it commits lazy pages and refuses early)crates/xcl/src/hle/dstorage.rs, tests:a_destination_unmapped_under_the_worker_fails_the_requestruns 20000 memory-source requests while another thread decommits and recommits the destination pageTested
--exact): 5 ×0xc0000005 STATUS_ACCESS_VIOLATION; with the fix: 10 of 10 passed;hle::dstoragetests: 14 passedcargo test --workspace -- --test-threads=4ond09f285: 693 passed, 0 failed, 41 ignoredgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareRegression run
main:
(
main63cdc25; this branch's base91f9a5ediffers from it by README.md only)PR:
Not tested
memcpycalled fromxcl.exewhile the world streams, RTX 3060 12 GB) may be this; I could not match itsxcl.exeoffsets to a build, so that is a guessAI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@mastrr9 on GitHub · 2026-11-24 04:05 UTC · original
Code audit + NVIDIA RTX 5080 test run on
d09f285014c6262b35f6b412d46eb4cfd70b7b2c:Review
Looks clean —
NtWriteVirtualMemory(raw-dylibfromntdll) matches the x64 Win32 signature, checksat != 0,NT_SUCCESS(>= 0), anddone == data.len(), avoidingWriteProcessMemory's expensiveNtQueryVirtualMemorypage-table walk while failing cleanly withE_ACCESS_VIOLATIONif the title unmaps a virtual destination mid-request.Tested
rustc 1.100.0(MSVC), debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4: 693 passed, 0 failed, 41 ignored.hle::dstorage::tests::a_destination_unmapped_under_the_worker_fails_the_request: passed.SKIPPEDGPU/D3D12 tests:gpu_geometry_wave32_prefix_count_over_a_mask/gpu_wave32_program_in_wave64_hardware(no wave64), plus 2 D3D12 debug-layer tests (no d3d12SDKLayers.dll).Not tested
scripts/smoke.ps1run (test suite only).AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.
@lordon1a on GitHub · 2026-11-24 04:07 UTC · original
Independent test report on
d09f285:Tested
616.64, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200),rustc 1.100.0(x86_64-pc-windows-gnullvm), debug buildcargo test -p xcl --lib hle::dstorage::tests -- --nocapture0.19s(a_destination_unmapped_under_the_worker_fails_the_requestok)Not tested
AI use
d09f285in a detached worktree, audited the diff, ran the test suite, and posted this report.@MesshM on GitHub · 2026-11-24 04:08 UTC · original
Test run of
d09f285014c6262b35f6b412d46eb4cfd70b7b2con AMD RDNA4. I merged it onto currentmainf4ce27clocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 702 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 661 passed, 0 failed, 21 ignoredSKIPPED;a_destination_unmapped_under_the_worker_fails_the_requestpasses.Review: Writing the destination with
write_own(NtWriteVirtualMemoryon the own process) turns a destination unmapped during the file read intoE_ACCESS_VIOLATIONfor that request instead of a fault inxcl-dstorage, the write-side counterpart of #561. I found nothing to change.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@DavidM1911 on GitHub · 2026-11-25 11:54 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main(crates/xcl/src/hle/dstorage.rs) — needs a rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.