Repository navigation
XG: fix CopyFromSubresource 7-argument ABI and guard destination span - #684
JGonzalezRodriguez wants to merge 1 commit into
Conversation
CopyFromSubresource (vtable slot xcl-dev#9) takes an extra u32 argument before src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old 6-argument signature, src was decoded as row_pitch and rows were copied far outside dst, causing access violations (xcl-dev#477, xcl-dev#662). Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch, 3D slice_pitch, and destination span readability before writing (logging a bounded warning and returning E_INVALIDARG on invalid spans), and add 2D, 3D, and invalid-span unit tests. Fixes xcl-dev#477 Part of xcl-dev#662
|
This branch seems to fix #477 on Linux! |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
@odd/tasks/draft-pr684-comment.md |
|
A retail run that reaches the call, on native Windows – the reports above cover the suite and the 60 s regression pair, which stay on the title's first screens. Tested
Not tested: AMD and Intel GPUs; One thing you may want: I had the same fix with a test of the title's own first call – BC7 512×512 with its full mip chain through both methods, level by level, nothing written between or after the rows; on AI use: Claude Code with Claude Fable 5.2 ran the builds, tests and runs and wrote this report; every number is from a run on the machine named. No game files are attached. |
|
Tested - Tool: OpenCode with DeepSeek V4.1 Flash 1017
Tested - native Windows, AMD RDNA2
Not tested: the #477 crash through a retail title ( AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report. |
|
Linux (Wine) run that reaches the call, with details for the one-line Linux report above. Tested
What came after
Not tested: Windows. The workspace suite: XCL doesn't build or run tests on Linux, so only the cross-built binaries ran. This PR without #273 on a run that reaches the call. AI use: Claude Code (Claude Opus 5.5) built the branches, read the logs and the kernel journal, and drafted this comment. The runs are mine, on the hardware above. |
|
Test report on native Windows for e56dbc3 (this PR's head), since the description has no Windows run yet. Written with Claude Code (Claude Fable 5.2) from runs on my machine; the blocks below are the unedited output of Tested
Regression run (a retail title, 60 s, no input) main (91f9a5e, this PR's merge base): this PR (e56dbc3): Not tested
|
|
Code audit + NVIDIA RTX 5080 test run on Review
Tested
Not tested
AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above. |
Integrates upstream PR ivall#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot ivall#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
Integrates upstream PR ivall#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot ivall#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
Integrates upstream PR ivall#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot ivall#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
|
Linux + NVIDIA run that reaches the call: Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (X11), vkd3d-proton 3.1 with the relaxed-vtable patch from #175 and a local dxil-spirv patch,
The fault on
With the PR, the title presented for about 14 s more and then stopped, and its watchdog ended it 29 s later. Not tested: the AI use: Claude Code (Claude Fable 5.2) read the diff, ran both builds of the title on my machine with |
Integrates upstream PR ivall#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot ivall#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
…(port of xcl-dev#976, xcl-dev#992) xcl-dev#976 and xcl-dev#992 are stacked on xcl-dev#684, which is not merged here: xcl-dev#1435 already fixes the 7-argument ABI another way (copy_args tells the two forms apart). Their checks are ported onto xcl-dev#1435's copy_from: the destination span (row and 3D slice pitch, from xcl-dev#684) must be writable memory (dstorage::writable, xcl-dev#976) and the tiled source range readable (shader::readable_range, xcl-dev#992) before anything is detiled or copied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Empirical test report (e56dbc3)Hardware / environment
Commands and results
Observed behavior
Not tested
AI use Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr684-focused.log and published. |
Fix
XGTextureAddressComputer::CopyFromSubresource(vtable slot #9) taking 7 arguments instead of 6, and validate the destination span before writing rows.CopyFromSubresourcereceives an extrau32parameter beforesrc(dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the previous 6-argument signature,srcwas read asrow_pitch, causingcopy_nonoverlappingto stride rows by the low 32 bits of the source pointer and trigger access violations (#477, first crash in #662).Supersedes #539 (the other parts of #539 have either landed on
mainin #435 / #451 / #486 / #574 / #602 / #634 / #636, are covered by focused open PRs, or need a separate single-purpose PR).Fixes #477
Part of #662
What is in it
crates/xcl/src/hle/xg.rs:copy_from(vtable slot Olympus: harden DXIL cache identity and validation #9) and the module doc comment to the 7-argument signature(dst, plane, sub, arg4, src, row_pitch, slice_pitch).row_pitch, 3Dslice_pitch, and destination span readability (gpu::shader::readable) before copying, logging a bounded warning and returningE_INVALIDARGon invalid spans.copy_into_and_copy_from_round_trip,copy_from_3d_round_trip, andcopy_from_rejects_invalid_dst_span.crates/xcl/tests/xg_oracle.rs:CopyFromSubresourcecall insubresource_copies_match_the_console_libraryto the 7-argument signature.Tested
rustc 1.98.1, debug,x86_64-pc-windows-msvcviaclang-cl+lld-link+xwin):cargo check --workspace --target x86_64-pc-windows-msvc --tests: passed (0 errors, 0 warnings).wine-11.0) on AMD Ryzen 9 7950X3D + NVIDIA GeForce RTX 4090 (driver610.57.04), debug:xcl --lib hle::xg::tests: 6 passed, 0 failed, 0 ignored (rgba8_64kb_s_layout,d16s8_is_planar_depth_and_stencil,console_floats_are_32_bits,copy_into_and_copy_from_round_trip,copy_from_3d_round_trip,copy_from_rejects_invalid_dst_span).xg_oracle: 6 passed, 0 failed, 12 ignored (oracle tests return early withoutXCL_SAMPLE_XG).xgcommits from D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements #539 were also independently tested against a retail title by @ddm-j in D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements #539 (comment) (confirmed validrow_pitch/slice_pitchand no access violation).Regression run
scripts/smoke.ps1runs (opened as draft until native Windowsscripts/test.ps1andmain+ PRxcl-smokeblocks are attached).Not tested
scripts/test.ps1(full workspace suite) andscripts/smoke.ps1regression runs (author builds on Linux/Wine).tests/xg_oracle.rswithXCL_SAMPLE_XGset against the consolexg_xs.dll.AI use
origin/main, refined the 2D/3D destination span check, wrote unit tests, ran cross-compile + Proton Wine checks, and drafted the PR description; reviewed by author).