DirectStorage: a deferred page-array entry is reread from title memory the title may have freed (#289) #476
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#476
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?
@Cattn on GitHub · 2026-11-24 00:49 UTC · original
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.
github.com/ivall/xcl@2997c9aca6/crates/xcl/src/hle/dstorage.rs (L834-L849)Review by Claude Code (Claude Opus 5.5) with a gpt-6.2-sol audit subagent; I checked each point against the code.
@requiemsnkrp on GitHub · 2026-11-24 00:55 UTC · original
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 on GitHub · 2026-11-24 01:37 UTC · original
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 on GitHub · 2026-11-24 01:46 UTC · original
@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 on GitHub · 2026-11-24 08:05 UTC · original
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.