feat(relinker): support short scalar guest GS instructions #11661
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11661"
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-27T01:28:20Z.
What
Support three- and four-byte scalar GS instructions by borrowing complete, safe neighboring instructions for the jump. Relocate supported followers, preserve original fault locations, and avoid replaying the completed GS operation when a repaired follower resumes. Unsafe borrowed spans keep the reviewed own-length UD2 fallback and leave following bytes untouched.
Refreshed bottom-up onto main
4138defef7c468835190768e5143e411bce92d6a, preserving every published November head and maintainer commit. Retains GS entry guards, original fault/resume behavior, unsupported-form fallback, deferred dependency controls, RELRO protection records and power-of-two alignment validation.The full native Windows build exposed a GS runtime-fixture link conflict: relinker static C++ exception symbols collided with libc exports. The libc-linked fixture targets now have a scoped CMake directory that follows the production library exception/link policy.
Increment over #11628:
github.com/boykopovar/[email protected]. This PR stays draft targeting main until prerequisites and external review gates are satisfied.Tested
Fresh native Windows evidence at exact head
b813f34cfbbadc2d73e879b1e973491add56377c: Windows 11 Pro build 26300, x86-64 Ryzen 7 9800X3D, WinLibs GCC 15.2, Release, Ninja, at most two build/test jobs. Full project CMake configuration succeeds using isolated immutable source exports with the pinned submodules, including MbedTLS frameworkced31491c5ec907a6be533512f19dc1779230ac1. Complete libc/libkernel targets and the relevant runtime/relinker test targets build through normal project CMake. 25/25 focused production/relinker tests pass, including thread/sysarch tests, native GS replay, production-libc execution, emitted executable/module startup, entry bounds/roots, RELRO and deferred dependencies. The complete graphics/media library set and GPU suite were not built or run.Conventions against origin/main and diff whitespace checks pass. Public-header audit: 407 libraries and 30,931 exports pass. The full scalar relinker-only suite also passed 246/246 at integration commit
1cd120090b3150edbc1a8be834d84851bca61bd4, before the fixture link-policy fix. Earlier macOS, translated Linux and ARM64 Windows results remain historical at the revisions in the November 5 evidence; they are not relabeled as testing this head.The overlap scan ran across 1,768 open PRs and failed closed for 82 conflicting/stale peers. Direct shared-path patches were inspected (the first scan had 19 source peers and 64 documentation-only peers; the final scan resolved #10861 to a debt-only overlap); no competing GS implementation was found. Known merge-order/integration work remains: declared #10518 and separately owned #10861, and shared entry-stub API lines with #15245. #15345 adds independent covered-SCE-RELRO range checks. No peer implementation was imported or author agreement/combined runtime validation claimed. Proposed #15245 coordination: retain both GS runtime setup and executable-export/module arguments when resolving the shared signatures/call site; agree merge order before either lands.
Main advanced after the pinned refresh; later upstream commits are not covered by these local results. Fresh collaborator re-review and required hosted production checks remain gates. A fresh selected-chain workflow dispatch after publication returned HTTP 403: admin rights required; a collaborator must dispatch
gh workflow run build.yml --repo boykopovar/AnyPS5 --ref main --field pr="11628 11661 11689 11698" --field full=true --field select=true. No PS5/title, physical non-AVX or performance verification is claimed. No paired performance captures are required or invented for this PR's absent speed claim.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 MarcZX10 on 2026-10-27T01:35:45Z.
Review: CHANGES_REQUESTED
The code and test review of the incremental #11628..#11661 changes did not find a confirmed defect. I cannot approve the performance claim/evaluation without the required paired captures, though.
Please provide all of the following from the same title, scene, and machine:
aps5-summary.jsonlline formainand the line for this change.python3 tools/trace_digest.py <trace>for each trace.The current PR description reports synthetic relinker/runtime correctness tests, but contains no performance captures or digest output. Until this evidence is available, the performance impact is unverified. At the time of review, conventions, intake, eligibility, Ubuntu relinker, ASan, register-context and macOS write-watch checks passed; Windows relinker and several macOS jobs were still pending. This review covers the incremental changes after #11628; the prerequisite remains independently reviewable.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T07:49:57Z.
Review: CHANGES_REQUESTED
Re-review — changes requested
A blocking global exception-path cost remains in the Windows continuation handling.
What I checked
339b7e0fd9bafe4bccbebb27777bb05752534b46and its Windows call chain inCrashReport.cppandGuestGs.cpp.Finding
[P1] Keep PE discovery off the process-wide first-chance exception path
CrashReport.cppinstallsReportCrashas a first-chance vectored exception handler. It callsGuestGsHandleException_nid_no_patchfor each exception. In this head, that function callsMovedAddress(context.Rip, false)before checking whether the exception isEXCEPTION_ILLEGAL_INSTRUCTION.MovedAddresscallsSection, which performsVirtualQuery, reads PE headers withReadProcessMemory, and scans section headers. The continuation handler similarly callsMovedAddressfor exceptions that continue.This makes ordinary exceptions in every process pay image-discovery and process-memory-read costs even when no GS replay or moved guest image is involved. The correctness tests and passing CI do not measure that system-wide runtime cost. The earlier paired-title-capture request is resolved because the PR now explicitly makes no performance claim; this is a separate regression risk introduced by the global handler.
Please add a cheap path that avoids PE discovery when the current image cannot have registered GS/moved-image metadata, and avoid installing the continuation handler for processes that do not need it. If the intended behavior requires the global handler, provide a representative exception-heavy title measurement against the same main build and show the overhead is acceptable. Keep the existing replay/fault tests passing.
Not verified
No local Windows build, GPU run, console/title run, or exception-heavy performance measurement was performed in this review.
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:27Z.
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 body claims synthetic ISA and emitted-program fixtures only, with no title run. Maintainers close PRs that cannot name a title and show a log line from main that reaches the change. Which title hits a short scalar
%gs:instruction today, and what does main print?Stacked branch. 33 commits and 36 files (+1769) because it carries #11624, #11628 and the #11090/#11276 prerequisite heads. #11689 and #11698 stack on this in turn, so the same diff is being reviewed up to four times. Please keep this draft until #11628 merges, or retarget it onto that branch so the diff shows only the short-instruction increment.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T06:57:18Z.
Review: COMMENTED
Reviewed — comments
The core GS replay and relocation paths were inspected at head
b813f34cfbbadc2d73e879b1e973491add56377c; the review is incomplete because not every changed file was read.What I ran
Used the
repo_read.pyreview reader to inspect the prepared description, commit list, manifest, diff, and selected repository files at the pinned head. No build or tests were run in this review.Results
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The full text of changed files was available through the reader, but I read only selected portions. In particular, I did not inspect all changed test, build, loader, and documentation files, so their behavior and coverage are not verified. No tests were run; the Windows build and test results in the PR description are author-reported.
To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and independently run the relevant checks.
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.