Shaders/validator+gfx10: guard null IDxcBlob slice UB, check GetStatus HR, and fix ds_wrap/global_addtid fields #630
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/630"
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?
Imported from fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T03:26:18Z.
Problem
Two sets of bugs in
victory-shader:GetStatusfailure inemit/validator.rs:std::slice::from_raw_parts(ptr(errors), len(errors))passed a rawIDxcBlob::GetBufferPointer()directly toslice::from_raw_parts, which is UB (and panics under Rust debugub_checks) when an emptyIDxcBlobreturns(null, 0).HRESULTreturned byIDxcOperationResult::GetStatuswas discarded; ifGetStatusitself failed,statusremained0andvalidate()falsely returnedOk(()).gfx10/fields.rs:ds_wrap_rtn_b32 vdst, vaddr, vdata0, vdata1takes two data VGPRs, but"wrap"was omitted from the 2-data-operand check (fields.rs:303), silently droppingvdata1fromFields::Ds::data, disassembly, andir::buildregister reads.global_load_dword_addtidandglobal_store_dword_addtidcompute addresses fromsaddr + offset + lane_id * 4and take novaddrVGPR, yetEncoding::Global(fields.rs:392) unconditionally decodedaddr: Some(v0), fabricating a spuriousv0read inir::build.Fix
get_status(result, &mut status)incrates/victory-shader/src/emit/validator.rs, releasingresultand returningErron failure, and borrow error blob bytes throughblob_bytes()guardingp.is_null() || n == 0.name.contains("wrap")in the 2-data-operandEncoding::Dscheck and guardEncoding::Globaladdrwith!name.contains("addtid")incrates/victory-shader/src/gfx10/fields.rs.blob_bytes_handles_null_or_empty_without_ubandds_wrap_rtn_decodes_both_data_operands_and_global_addtid_has_no_vaddr.Verification
cargo test -p victory-shader --locked emit::validator::tests: 1 passed, 0 failedcargo test -p victory-shader --locked gfx10::: 13 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.