Shaders/own_bits: reject escaping non-test lane masks written outside the loop body #789
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!789
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-789"
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?
@AscilCH on GitHub · 2026-11-25 07:35 UTC · original
AscilCH:fix/shader-own-bits-non-test-mask-leaves→main· +72 −3 · 1 files · 1 commits · openSummary
Fix an unsoundness hole in
own_bits::Ctx::site(crates/victory-shader/src/emit/own_bits.rs):LEAVEScheck unconditionally skipped everyis_mask(w)write outside the loop body (lp/pre), relying on theSTALEcheck to catch escaping masks.STALEseededdeponly withtests(v_cmp_ne (x & bit), 0). Any other lane mask written outside the body (such asv_cmp_eq_u32 s[14:15], s10, v0in the latch depending on the round's bit indexs10) was exempted fromLEAVESand absent fromSTALE, allowing round-dependent masks to escape into post-loop instructions or guards even though wave64 and two split wave32 halves visit different rounds.Changes
LEAVES, only exempt anis_mask(w)write when its boolean support contains no atom defined insidelporpre(preserving loop-invariant outer-EXECsaves while checking loop-dependent masks).depwith freshAtom::Lane/Atom::Quad/Atom::Opaqueatoms defined by non-body instructions insidelpso indirect escapes throughEXECorst.phi_masksinto post-loop guards/exits are also caught bySTALE.own_bits::tests::a_non_test_mask_written_in_latch_cannot_escape_after_looptesting both direct post-loopv_cndmask_b32reads and indirect escapes vias_and_saveexec_b64.Verification
cargo test -p victory-shader --locked -- own_bits:7 passed; 0 failed; 0 ignored.cargo test -p victory-shader --locked -- wave64:7 passed; 0 failed; 0 ignored.cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: 0 warnings.cargo xtask policy:171 files ok.(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.