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
startup: ring_copy reads guest memory with an unguarded memcpy after the probe #3468
On main cf0c30a, with X2W_TRANSLATED_TITLE_INPUT_SNAPSHOT=1 (#2862), src/startup_stubs/d3d12_draw.inl:2684-2687 probes the input range with readable_window and then calls ring_copy(..., true).
ring_copy (src/startup_stubs/d3d12_xs_device.cpp:2885) copies with a plain std::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) and guarded_copy (linear_buffer_backing.h:248) use it.
ring_copy has three call sites, all probe-then-copy:
Call site
Probe
d3d12_draw.inl:2686, compute input snapshot
readable_window at :2684
d3d12_draw.inl:2065, texture upload
readable_window on the whole range at :1960, same function
d3d12_xs_device.cpp:2897, upload_from_title, called at :4603
readable_window at :4602
Measurement
One long local run of the application, switch off and then on, over the comparable window:
off
on
translated compute dispatches
10
3,189
"placed buffer that does not alias" input refusals
4,693
0
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
Copy with guarded_memcpy(dest, source, bytes, false) in ring_copy and 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.
A synthetic test that reserves a page without committing it (as tests/startup_local_log_check.cpp:574 does) and checks the refusal and the absence of a crash.
Activity