Loader: the illegal-instruction handler reads no byte past the faulting page (ud2 at a page end faulted inside it) #259
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!259
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-259"
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?
@sharan104 on GitHub · 2026-11-26 13:33 UTC · original
sharan104:fix/loader-audit→main· +72 −27 · 1 files · 1 commits · opencrash.rs'semulate_amd_onlyhandles everyEXCEPTION_ILLEGAL_INSTRUCTION.console_insn::emulatepasses everyud2on to it, so this path is live. It read 3 bytes at the faultingRipbefore checking where the page ends, andsse4athen read up to 6 more through a raw pointer. So two cases made the handler fault inside VIctory itself when the next page is unmapped:ud2in the last 2 bytes of a pageextrq/insertqcut off by the page endThe title's handlers then saw an access violation coming from our handler, instead of the illegal instruction they expected. The bounded copy was already there for the
clwbpaths; it just came too late.Fix: the bytes left in the faulting page (up to 32) are copied once, up front, and every check reads only that copy.
sse4anow takes a slice, returnsNonewhere the bytes end before the instruction does, and is no longerunsafe. Behaviour for whole instructions is unchanged.Test:
nothing_past_the_page_is_read_for_an_instruction_at_its_endplaces aud2, a truncatedextrqand a wholeextrqin the last bytes of a page whose next page isPAGE_NOACCESS. Before the fix the test process died withSTATUS_ACCESS_VIOLATION; after it, the test passes (10 runs out of 10).Results:
cargo test -p victory-loader --lockedpasses.-D warningsis clean with and without--all-features, apart fromdescriptor_sites.rs:277, which is already failing onmainand which #169 fixes.🤖 Generated with Claude Code
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.