feat(relinker): support VEX guest GS memory accesses #11698
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11698"
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 boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-27T03:59:20Z.
What
Replay bounded C4/C5 VEX guest GS memory moves through the protected Windows GS frame. The replay preserves effective addresses, native alignment and transfer widths, and upper YMM lane behavior. Unsupported encodings retain their own-length
UD2fallback. Conversion and startup are host-AVX-independent. Reaching VEX replay without OS-enabled AVX state reports an illegal instruction at the original guest RIP with the stack and registers restored.This follow-up adds four cases for C4/C5 RIP-relative
VMOVDQUloads borrowed by a short GS instruction, covering both 128-bit and 256-bit forms. It merges the published #11689 headfaf9d25c09f105a84ed01c3c9785651d9d989281, which adds coverage for a borrowed EBX write feeding an SSE load or store through RBX. The candidate changes two Python tests relative to the previous published VEX head. VEX increment over #11689.This PR stays draft targeting main. The #11661 worker ended with its current-main integration unpublished, so the updated short replay and scalar replay-fault work are still pending in the published stack. The merge preview against main
c8f72e905cce039a05970ed39d2373f770217901has inherited conflicts in the ELF reader, ELF bounds tests and libc/libkernel debt. #10518 and #10861 remain open. The shared entry-stub signatures with #15245 still need merge-order coordination.Tested
On native Windows 11 Pro build 26300, x86-64 Ryzen 7 9800X3D, 79/79 focused tests passed with the test scripts at
74746df3147c84663716e32f0fd7dc920cbe2ed8and archived WinLibs GCC 15.2 Release binaries. Hashes for 774 archived relinker, libc, libkernel and build inputs matched the previous published VEX headf16c9e062bd1d7607e1b3c976a6071904a81960cafter line-ending normalization. The run covered scalar and short GS replay, SSE and VEX faults and fallback, synthetic--no-avxand cached lookup, production-libc replay, executable and module startup, entry roots and bounds, relocations, TLS, deferred dependencies and sysarch/pthread. Both runners passed 81/81 VEX and 85/85 SSE address cases.Negative controls shifted the four new VEX replay displacements by one byte. Each failed the expected YMM-state assertion. Conventions passed against
origin/mainusing both checker versions, and the diff whitespace check passed. The function-name overlap scan found no matching open implementations for the queried names. Existing shared-file and merge-order work remains documented above.One independent reviewer inspected
f16c9e062b..74746df314, verified both published ancestors, checked the archived source correspondence and JUnit results, and reran the four displacement controls. They found no blocking issues. The public-header audit verified unique declarations and umbrella coverage for 407 libraries and 30,931 exports.The earlier contributor-reported 50-test production run and hosted checks apply to
f16c9e062bd1d7607e1b3c976a6071904a81960c. Fresh current-main binaries, hosted production CI and collaborator re-review remain gates. Physical non-AVX hardware and title execution remain unverified.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:25Z.
Review: COMMENTED
Correction (2026-11-01): this review's claim that maintainers close PRs without a title ID is wrong. CONTRIBUTING allows
Unblocks: none; a title is only required when the PR fixes a title. The technical points below are unaffected.No title ID and no log line. The Tested section says "No PS5/title, performance, non-AVX-host or macOS verification is claimed", and the checklist has no title. Maintainers close PRs that cannot show a title reaching the change on main. Which title executes VEX-encoded
%gs:accesses, and what log line on main (with the UD2 trap from the current fallback) shows it?Stacked branch. This is 53 commits and 40 files, +2665, because it carries the prerequisite stack (#11624, #11628, #11661, #11689, plus the carried #11090/#11276 heads). The feature increment is one nine-file commit. Reviewers cannot approve the main-target diff as shown. Please keep it draft until the prerequisites merge, or retarget it onto the prerequisite branch.
AVX hosts. The description says non-AVX hosts were not verified. The converted Windows output now executes VEX instructions on the user's CPU. What does the relinker do when the host lacks AVX: refuse to convert, keep the UD2 trap, or emit code that faults at run time? That choice should be in the code and covered by a test, not left unverified.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T06:56:32Z.
Review: COMMENTED
Reviewed — no blocking findings
The pinned head is
f16c9e062bd1d7607e1b3c976a6071904a81960c; the inspected paths show the advertised GS replay and startup wiring, but this review is incomplete, so approval is not justified.What I ran
No commands or tests were run. The repository reader was used to inspect the prepared diff and source at the pinned head.
Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
The manifest lists 35 changed files, all marked included. I read the description, commits, manifest, changed-file listing, selected ranges of
diff.patch,GuestGs.cpp, andWindowsGuestGs.cpp. I did not read every listed changed file or every changed hunk, including the full test suite, other runtime and entry-stub changes, and CMake changes. The author-reported Windows build and 50 focused test results were not independently verified. No checks were run.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and run the focused checks on this head before relying on the reported results.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T18:58:11Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix replay-table lookup so guest GS accesses after an earlier unsupported instruction are not silently skipped.
What I ran
Reviewed head
74746df3147c84663716e32f0fd7dc920cbe2ed8from the prepared diff and pinned source usingrepo_read.py. No build or tests were run; the Windows 11 test results in the description are author-reported.Results
Findings
Blocking
core/libs/prx/libc/src/specifics/windows/GuestGs.cpp:196—Findonly accepts the trap address when it equalsrecord + 29, butWindowsGuestGs::TryAppendemits each guest instruction’s trap atrecord + 24(core/relinker/elfpatcher/src/windows/WindowsGuestGs.cpp:155). As written, the runtime never recognizes the generatedUD2, so supported GS accesses always fall through as illegal instructions instead of replaying. Match the emitted trap offset (and keep the replay-address bounds consistent).Non-blocking
None.
Not verified
To get this to a good state
Find, then rerun the focused GS replay tests, including VEX loads. I would rerun no commands on this head because no checks were run in this review.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:56:40Z.
Review: COMMENTED
The trial merge conflicts in
ElfReader.cppandElfReaderBoundsTests.cpp. The VEX replay path should retain the native comparison for 128- and 256-bit moves, alignment faults, and upper YMM state. Please keep the host-feature-denial control too. Its conversion should still succeed without AVX and the guest instruction should take its documented fallback at execution. Please use debt fragments for the three library and relinker changes. I reviewed this in source and did not run native Windows tests.AI-assisted: yes.
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.