Skip to content

test(relinker): verify entry-stub bounds before allocation - #80

Draft
Thimo188 wants to merge 2 commits into
mainfrom
upstream-pr/7704
Draft

Thimo188 wants to merge 2 commits into
mainfrom
upstream-pr/7704

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#7704, originally opened by rajvveer.

Source commit: 36eeec6bb5e421a3d705469af90398dc87749830. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


What

The runtime boundary test in boykopovar#6204 passes with and without its allocation guard. The separate CMake test searches for literal source strings, so it cannot establish that the guard runs before resize.

Depends on boykopovar#6204 (included). The first commit, 26375a30ef, is vrebel11's production guard rebased onto main, with authorship preserved. My contribution is the second commit, 36eeec6bb5: test coverage and registration only. This remains a draft for coordinating the follow-up while boykopovar#6204 is open; the test commit can also be cherry-picked into boykopovar#6204.

  • Replace the source-text guard with a runtime check. A test-only operator new records the largest allocation, following UseRewriteAllocation.cpp. With 4096 bytes left below INT32_MAX, the builder must reject the 64 KiB startup buffer before allocating it.
  • Keep successful controls at a low RVA and within 1 MiB of INT32_MAX. Use WindowsImportBuilder for the imports instead of a second list of function names.
  • Register windows_entry_stub_bounds on every host, with a 20-second timeout. Remove WindowsEntryStubEndpointGuard.cmake and its registration; fix the trailing newline and spacing.

This addresses the review on #6204. It does not establish a fix for the intermittent GCC crash in boykopovar#5927.

Tested

Windows x64, WinLibs GCC 15.2.0 r7 UCRT/POSIX, Ninja 1.13.2, Python 3.14.2; relinker-only builds with BUILD_TESTING=ON.

  • Fresh full Release run: PR head 3a416dd952 merged with main 25648aa121 in a separate checkout (8b378bd976). Fresh configure and full build passed without compiler warnings. Serial CTest completed in 304.53 s: 203 passed, 0 failed, 1 skipped out of 204. No concurrent build/test job was started. windows_dependency_diagnostics, guest_module_identity and windows_import_modules all passed in this run.
  • Regression controls: unchanged main fails with The entry stub allocated past the RVA limit before rejecting it. Moving the endpoint check after resize also fails with that message. Restoring the guard passes, including the high-RVA control. Debug with _GLIBCXX_ASSERTIONS passes entry_stub and windows_entry_stub_bounds, 2/2. Both new source files pass -Wall -Wextra -Wpedantic -Werror syntax checks.
  • Unchanged successful output: a synthetic Windows PE conversion is byte-identical before and after the guard, SHA256 8c1c8a24b8fb57d62a2ea0b06ab9551d848e1f1f5fa4e9828b4edb7c40b7783f.
  • Publication rebase: head 36eeec6bb5 is based on main 8a526d4495. Compared with the fully tested integration, core/relinker, root CMake, cmake, tools and the build workflow are unchanged. The exact rebased commit has not received another full suite run. Conventions and whitespace checks pass.
  • Independent review: a separate AI review agent inspected the guard, connected PE caller, allocator instrumentation, test registration and recorded evidence. It found no blocking defect. It did not rerun tests; the 203-pass result above is the actual full run.

Earlier, on base 017f2151ca, a parallel 204-test run that overlapped a Debug build had 200 passes, three timeouts and one skip. The three tests named above then passed serially on both unchanged main and the fix, and passed again in the fresh full serial run. The cause of the parallel failures remains unestablished, so parallel CI stability is not claimed.

long_paths skips because this host's LongPathsEnabled is not 1. No Windows or antivirus settings were changed. Linux/macOS execution and upstream build checks remain pending. No full runtime, title, GPU, performance or exhaustive PE-validation claim is made; the vector-capacity branch was inspected, not forced through an impractically large public input.

Overlap review: the required tools/pr_overlap.py run completed serially after refreshing a partial-clone object fetch. It reported the expected overlap with included boykopovar#6204. The shared-file diffs it could not compare were inspected for boykopovar#2780, boykopovar#5021, boykopovar#5138, boykopovar#6044, boykopovar#6802, boykopovar#6879, boykopovar#6977, boykopovar#7173, boykopovar#7332, boykopovar#7450, boykopovar#7531 and boykopovar#7594; boykopovar#6586 was inspected when the bot subsequently added it. They add other sources/tests or change test registration. boykopovar#6044 would require adapting the new registration if its add_component_test conversion lands first. boykopovar#7594 changes MXCSR handling around the guest entry call, away from the allocation guard. boykopovar#6586 adds a separate guest_zero_initializer registration. No additional prerequisite was identified; no combined runtime result is claimed.

Checklist

vrebel11 and others added 2 commits October 19, 2026 08:18
Replace the source-text guard with an allocation-observing runtime test.
The unchanged builder and a check moved after resize both fail; the guard
passes, including a valid allocation near the upper RVA limit.

Register the test on every host and use the production import builder.
Addresses the review feedback on boykopovar#6204.
@github-actions github-actions Bot added the already in main Merging would not change main; never closed automatically label Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Merging this pull request would not change main: GitHub's test merge of it into main at 82216ca has the same files as that commit, and no file it touches has changed in main since, including its mode and type. Its changes look merged already, possibly through another pull request. Nothing is closed automatically. Close it if it is superseded, or push what is still missing; the already in main label goes away once merging would change main again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

already in main Merging would not change main; never closed automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants