startup: ring_copy reads guest memory with an unguarded memcpy after the probe #3470
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#3470
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?
@Leyukaka on GitHub · 2026-11-29 15:56 UTC · original
On main
cf0c30af, withX2W_TRANSLATED_TITLE_INPUT_SNAPSHOT=1(#2862),src/startup_stubs/d3d12_draw.inl:2684-2687probes the input range withreadable_windowand then callsring_copy(..., true).ring_copy(src/startup_stubs/d3d12_xs_device.cpp:2885) copies with a plainstd::memcpy. A page that is decommitted or protected between the probe and the copy faults inside the stand-in instead of taking the existing "could not be copied" refusal.x2w_local::guarded_memcpy(src/startup_stubs/local_log.h:176) already covers this case: it returns false on an access violation or an in-page error.copy_title_bytes(d3d12_draw.inl:728) andguarded_copy(linear_buffer_backing.h:248) use it.ring_copyhas three call sites, all probe-then-copy:d3d12_draw.inl:2686, compute input snapshotreadable_windowat:2684d3d12_draw.inl:2065, texture uploadreadable_windowon the whole range at:1960, same functiond3d12_xs_device.cpp:2897,upload_from_title, called at:4603readable_windowat:4602Measurement
One long local run of the application, switch off and then on, over the comparable window:
With the switch on, 5,000 inputs were snapshotted (about 8.7 MiB). No snapshot refusal and no new fault was logged. This is one run, and output correctness was not checked.
Proposal
guarded_memcpy(dest, source, bytes, false)inring_copyand return false on a fault. The snapshot caller then refuses on its existing path, so the opt-in fails closed. The other two callers already handle a false return.tests/startup_local_log_check.cpp:574does) and checks the refusal and the absence of a crash.I'm working on this.
github-bot referenced this issue2026-11-30 20:05:22 +00:00