Repository navigation
GPU: read small buffer diagnostics via read_into instead of VirtualQuery - #2142
fuzeofficlal wants to merge 1 commit into
Conversation
`describe` still queried `texture::committed` (`VirtualQuery`) and formed a raw slice over live title memory for `<= 64`-byte buffer SRV and UAV ranges, walking pool regions on every noted draw and dispatch while exposing a TOCTOU window against concurrent unmapping or page protection changes. Read `4..=64` byte spans into a 64-byte stack buffer with `host::read_into`, matching the constant-view path. Closes Marvisak#913.
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --features diagnostics --lib describe_reads_small_buffers_without_faulting_on_unmapped_memory— passedcargo clippy -p victory-gpu --all-targetsand--features diagnostics --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean replacement of VirtualQuery with read_into for small buffer diagnostics, verified against unmapped memory without faulting. Looks good.
AI-assisted (Gemini 4 Neon).
Ported from Marvisak/VIctory#2142 (GPL-3.0-or-later). describe()'s small-buffer path still queried committed pages and built a slice over live title memory for <=64-byte buffer views, on every noted draw: a TOCTOU window against unmapping or guard changes, and an invalid (null, 0) slice for an empty range. It now reads 4..=64-byte spans with host::read_into into a stack buffer; empty and sub-dword ranges omit the float suffix. Test describe_reads_small_buffers_without_faulting_on_unmapped_memory covers unaligned SRV/UAV formatting, boundary lengths and reserved or unmapped pages.
|
Automated triage for the maintainers. Merge candidate. In CI: passing ( Generated by Claude Code |
Problem
While
6d021feswitcheddescribe()'sView::Constantpath tohost::read_into, thesmallclosure added right above it in7000573(crates/victory-gpu/src/draw.rs) still queriestexture::committed(VirtualQuery) and constructsstd::slice::from_raw_partsover live title memory for<= 64-byte buffer SRV and UAV views. That walks pool regions on every noted draw/dispatch, leaves a TOCTOU window against concurrent unmapping or page-guard changes, and passes(null, 0)tofrom_raw_partswhenat == 0 && len == 0.Changes
4..=64-byte buffer SRV/UAV spans into a 64-byte stack buffer viacrate::host::read_into(omitting empty and sub-dword< 4-byte spans), eliminatingVirtualQueryandunsafeslice construction.draw::tests::describe_reads_small_buffers_without_faulting_on_unmapped_memoryunderdiagnosticscovering unaligned SRV/UAV float formatting, boundary lengths (0,2,6,64,68), and reserved/unmapped page boundaries.Closes #913.