You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DirectStorage: a deferred page-array entry is reread from title memory the title may have freed (#289) #476
From a static review (no builds or runs) of 2997c9a:
This follows up on #289. For destination entries that were zero at enqueue, the worker rereads the title's page array after checking readable(), which only checks memory accessibility at that point. If the array has been reused, the worker can pick up a different valid page number and copy to the wrong title page, or the read can fault if the memory is unmapped between the check and dereference. This is a memory-lifetime bug, and I found no indication of malicious code.
Require the title to keep any array with deferred entries valid until the request completes.
I'll take this one, unless someone already has it in progress.
Plan (small, one PR):
In execute, read the deferred entries with read_own (ReadProcessMemory on the process itself, which fails instead of faulting) rather than readable() + read_unaligned. If the array is unmapped between the check and the read, the request then fails with E_ACCESS_VIOLATION and the xcl-dstorage worker no longer takes the process down.
The wrong-page case cannot be told apart from a legitimate late fill: if the array is reused before the request's turn, the reread may still find a valid page number. The title has to keep an array with deferred entries valid until the request completes, which DirectStorage: a destination page array entry that is 0 at enqueue is read at the request's turn #289 already assumes. I will say so in the comment there; there is no code fix for it.
Test: requests with a deferred entry run while another thread decommits and recommits the array's page. Before the change the test process ends with 0xc0000005; after it, every request either completes or fails with E_ACCESS_VIOLATION.
Measured on a retail title; a change that narrows this window instead of widening it
NVIDIA GeForce RTX 4080 SUPER (driver 610.88), Windows 11 26200. With a local counter by HRESULT, a run of main (2997c9a) past the title's account prompt had about 2,850 requests fail with E_ACCESS_VIOLATION (0x89240009) in 230 s. With extra logging on the refusal path, each one had a one-entry destination page array that was still 0 at the request's turn, after#289's reread.
The half-full auto-submit runs these requests before the title fills the entry. The title fills it after EnqueueRequest and before its own Submit. Polling the array from the worker would fix the failures but lengthen the window this issue describes, so I'm proposing this instead:
A queue holding a request whose destination array had a 0 entry at enqueue doesn't submit by itself.
The title's Submit reads the missing entries again on the title's own thread, through ReadProcessMemory as at enqueue.
With that change the same run had no 0x89240009 failures. It narrows the window but doesn't close it, because the fallback still reads late. PR to follow.
Measured and written with Claude Code (Claude Opus 5.5); I checked it before posting.
@papasmurph0 thanks for measuring it. Your ~2,850 0x89240009 in 230 s are streaming requests whose data never arrives, which is the bigger problem here. Rereading at the title's Submit addresses it, and #509 does not.
#509 changes only how the worker's reread reads: read_own instead of readable() followed by a dereference, so an array unmapped in between fails the request instead of ending the process. That still matters for the fallback you keep. Both changes touch the same block of execute, so whichever lands second needs a small rebase. I'm happy to rebase #509 onto your PR, or you can build on #509, whichever you prefer.
I measured destination page arrays in three retail runs on an RTX 5080 using local instrumentation on af20b4b, before #289. The samples below are from explicit Submit on manual queues. They are separate runs.
Of 24,315 file requests that failed with 0x89240009 and had an incomplete destination list at Enqueue, 24,236 had every entry filled at Submit and no earlier non-zero ID to compare. In the other 79 requests at least one previously non-zero entry had changed. Those 79 lists also started incomplete.
In another run, 4,080 lists that were complete at Enqueue changed before Submit. All 5,712 replaced slots still referred to allocated old page IDs at Submit. Zero old IDs were unallocated. This measures the old pages’ allocation state. It leaves the title’s intended destination unknown.
In a third run, 17,639 requests shared the same table start with another pending request and had disjoint destination byte ranges in the Submit snapshot. None had an independently corroborated ID for a slot that was blank at Enqueue. The count is per request.
This puts numbers on the ambiguity described in #509. A populated table and live page IDs at Submit alone cannot distinguish late publication from table reuse. These figures predate #289.
AI use: OpenAI Codex checked the saved counters and the classification code and wrote this comment.
Activity
requiemsnkrp commentedon Nov 24, 2026
I'll take this one, unless someone already has it in progress.
Plan (small, one PR):
execute, read the deferred entries withread_own(ReadProcessMemoryon the process itself, which fails instead of faulting) rather thanreadable()+read_unaligned. If the array is unmapped between the check and the read, the request then fails withE_ACCESS_VIOLATIONand thexcl-dstorageworker no longer takes the process down.0xc0000005; after it, every request either completes or fails withE_ACCESS_VIOLATION.AI use: Claude Code (Claude Opus 5.5).
papasmurph0 commentedon Nov 24, 2026
Measured on a retail title; a change that narrows this window instead of widening it
NVIDIA GeForce RTX 4080 SUPER (driver 610.88), Windows 11 26200. With a local counter by HRESULT, a run of
main(2997c9a) past the title's account prompt had about 2,850 requests fail withE_ACCESS_VIOLATION(0x89240009) in 230 s. With extra logging on the refusal path, each one had a one-entry destination page array that was still0at the request's turn, after #289's reread.The half-full auto-submit runs these requests before the title fills the entry. The title fills it after
EnqueueRequestand before its ownSubmit. Polling the array from the worker would fix the failures but lengthen the window this issue describes, so I'm proposing this instead:0entry at enqueue doesn't submit by itself.Submitreads the missing entries again on the title's own thread, throughReadProcessMemoryas at enqueue.With that change the same run had no
0x89240009failures. It narrows the window but doesn't close it, because the fallback still reads late. PR to follow.Measured and written with Claude Code (Claude Opus 5.5); I checked it before posting.
requiemsnkrp commentedon Nov 24, 2026
@papasmurph0 thanks for measuring it. Your ~2,850
0x89240009in 230 s are streaming requests whose data never arrives, which is the bigger problem here. Rereading at the title'sSubmitaddresses it, and #509 does not.#509 changes only how the worker's reread reads:
read_owninstead ofreadable()followed by a dereference, so an array unmapped in between fails the request instead of ending the process. That still matters for the fallback you keep. Both changes touch the same block ofexecute, so whichever lands second needs a small rebase. I'm happy to rebase #509 onto your PR, or you can build on #509, whichever you prefer.Written with Claude Code (Claude Opus 5.5).
badoomtch commentedon Nov 24, 2026
I measured destination page arrays in three retail runs on an RTX 5080 using local instrumentation on
af20b4b, before #289. The samples below are from explicit Submit on manual queues. They are separate runs.0x89240009and had an incomplete destination list at Enqueue, 24,236 had every entry filled at Submit and no earlier non-zero ID to compare. In the other 79 requests at least one previously non-zero entry had changed. Those 79 lists also started incomplete.This puts numbers on the ambiguity described in #509. A populated table and live page IDs at Submit alone cannot distinguish late publication from table reuse. These figures predate #289.
AI use: OpenAI Codex checked the saved counters and the classification code and wrote this comment.
DirectStorage: a virtual destination is written without faulting
HLE: fix DirectStorage late page races, fence cell deadlock, and PSO …
DirectStorage: a deferred page-array entry is reread without faulting (…
DirectStorage: a late page array holds a half-full queue until Submit
DirectStorage: a memory source is copied without faulting
DirectStorage: a virtual destination is written without faulting
Merge pull request #509 from requiemsnkrp/dstorage-deferred-page-arra…
hle: harden world streaming, physical pages, and GameInput/KBM playab…
hle: harden world streaming, physical pages, and GameInput/KBM playab…
hle: harden world streaming, physical pages, and GameInput/KBM playab…