xcrdapi: a TO_PAGES read keeps page tokens the array held at enqueue, though the title fills the array after enqueueing #457
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?
Imported from brcly/TuxBox. Originally posted by Jerkin42 on 2026-11-29T07:54:19Z.
Seen on: RX 9060 XT (RADV), ProjectScarlett 1.0.2.1, first on
mainb8355fa2with open PRs of the time;page_tokens()is unchanged onmain28717263.What the code does.
queue.rscapture()snapshots a TO_PAGES request's token array at enqueue, because "the title may reuse it after enqueueing". When the request runs,page_tokens()reads the array again, but only to fill entries that were 0 at enqueue. An entry that was non-zero at enqueue keeps its enqueue-time value.What the title does. It fills page arrays after enqueueing them, thousands of times per run ("page array #8193 … was filled after its request was enqueued: [0x0] then, [0x…] when it ran"). An array whose memory still holds an earlier request's tokens at enqueue is non-zero then, so the snapshot keeps the earlier request's pages, and the read lands there:
[0x72b00]at enqueue,[0x73c50]when the request ran.On the console the DMA engine reads the page array when the request executes, so the run-time contents are the ones that count.
Possible effect. The read writes into pages that now belong to another allocation, and the intended destination keeps stale bytes. In our runs the game later stops in its resource pointer fix-up (an
int3when a pointer lies in none of the resource's regions; the pointer was0x69689788against regions at most 0x1630 long), or reads a-1pointer, about 90 game frames after the first story mission starts. Re-reading the array at run time (below) did not move that crash, so we can't say this bug causes it. It is a correctness problem either way.Local change we ran. In
page_tokens(), always read the array when the request runs and prefer each live non-zero entry, falling back to the snapshot only where the live entry is 0. Happy to open a PR with a unit test if that's the right reading of the contract, or to hear why the enqueue snapshot is needed (a title that rewrites the array for a later request before this one runs?).Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T12:19:19Z.
Now that it has merged, a game run with it on an RTX 5090 (a build on
maind2eb99edwith #462, #463, #455, #461 and others; one run, about 7 minutes after the first story load):replaced_pageswas logged on 20 sampled lines, and the counter passed #16385. So a title replacing non-zero tokens afterEnqueueRequestis the normal case here, not a rare one:Every one of those writes would have gone to a stale page before. My earlier builds only logged the zero-to-filled kind, so they couldn't see this. I can't tell which of my older crashes it explains. This run had none of the title CPU crashes; it ended on an Xid 109 timeout instead.