Repository navigation
Recompiler: guard 32-bit raw-buffer OOB wraparound in Direct DXIL - #3265
Conversation
c74d3f2 to
de945c0
Compare
In Direct DXIL mubuf and buffer_atomic (stride == 0), off = voff + OFFSET and e = off + bytes were compared against d2 without checking for 32-bit unsigned wraparound (xcl-dev#1893). A large voff near 2^32 wrapped below d2 and passed the OOB guard while 64-bit buffer_window() carried into the adjacent 4 GiB UMA window. Check unsigned carry in pure 32-bit arithmetic (off >= voff when OFFSET != 0, and e >= off) before comparing e <= d2, avoiding i64 promotion while closing the wraparound bypass. Assisted-by: Antigravity (Gemini 4 Neon High) (cherry picked from commit 70e600d) (cherry picked from commit fcbd0d1) Ported to main unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
de945c0 to
cb7fe9b
Compare
|
merge-check |
|
merge-check claim |
|
merge-check |
Overlaps #1933 (PracticalStudios, same issue #1893, mergeable): this is amd-dev's version (
fcbd0d14, raylitebull). Maintainers, keep one of the two.In direct DXIL, raw
buffer_load/buffer_atomic(stride 0) computedoff = voff + OFFSETande = off + bytesand compared them with the buffer size without checking 32-bit wraparound (#1893). Avoffnear 2^32 wrapped below the size, passed the bounds check, and the 64-bit window address carried into the next 4 GiB window. The check now also requiresoff >= voff(when OFFSET != 0) ande >= off, in 32-bit arithmetic.What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs: the carry checkscrates/xcl/src/gpu/dxil/core_tests.rs:raw_buffer_oob_check_guards_32bit_wraparoundTested
cargo test --workspace --no-fail-fast -- --test-threads=4on cb7fe9b: 2605 passed, 4 failed, 49 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3:E_OUTOFMEMORYfromCreateComputePipelineStateat seeds 70 / 545 / 1019 / 1507, the same as on main on this machine; they pass on Kalmarv's RTX 5070 Ti, so they come from this machine's driver / setup, not the code. SKIPPED GPU tests: 30, almost allno wave64.OFFSET20, as in amd-dev's laterf089a9df.core_tests.rs(headcb7fe9bd): in the first pushes it was at the same line as Recompiler: fix Direct DXIL live double-ext scan and movrel VGPR range #3266's test, a merge conflict Kalmarv found; nothing else changed.-StartupTimeoutSeconds 3600for the cold pipeline rebuild new DXIL needs.Regression run
main:
this PR:
Not tested
AI use
fcbd0d14(raylitebull, from70e600d5, written with Antigravity (Gemini 4 Neon High)).🤖 Generated with Claude Code