fix(tests): link Windows test executables without high-entropy addresses #18253

Merged
angrysandhill merged 1 commit from upstream-pr/18253 into main 2026-11-13 00:47:48 +00:00
angrysandhill commented 2026-11-11 00:21:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by angrysandhill on 2026-11-11T00:21:49Z.


What

Link the Windows test executables with --disable-high-entropy-va, the address-space layout the relinker already gives titles.

With MinGW's default HIGH_ENTROPY_VA, Windows places the stacks of a test process's start-up threads anywhere from 4 GiB to past 1 TiB. These are the main thread and the loader's worker threads. So they sit inside the guest arena range in almost every run. Each is a 2 MiB reservation on a 2 MiB boundary. When one lands on the AGC driver memory at 0xfe0000000, driver start-up fails with replace guest placeholder with private memory: Attempt to access invalid address (#18252).

  • add_test_executable: adds the flag for every test executable it makes.
  • guest_video_out_wqhd_detection_exit_tests: built with add_executable so that DLL teardown runs without --wrap=main. It loads libc, so it gets the same flag.
  • agc_driver_frame_replay_relaunch_tests: drops its own -Wl,--disable-high-entropy-va, which the helper now covers.

#679 made the same change for titles: the relinker writes them without HIGH_ENTROPY_VA (0x140 or 0x100 in WindowsPeWriter.cpp), and test_windows_address_space.py checks that a title's main thread stack stays below 0x200000000. This applies it to the test executables. The trade-off is the one #679 describes: stacks and heaps keep 8-bit bottom-up randomization near the bottom of the address space, and images are still relocated.

Tested

Setup: Windows 10 Home 22H2 (10.0.19045), AMD Radeon RX 6750 XT, AMD Software Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON. Built on main 41b9e25 with this change. The branch is based on b1f8766e5f, and the three changed spots are identical there.

Flags: with the change, objdump -p shows HIGH_ENTROPY_VA on none of the 2,437 executables under build/tests.

Where host memory sits at libc load. These numbers come from a local libc build that printed the guest arena's host holes and exited; that build is not part of this PR. Each run was agc_driver_draw_cache_reuse_tests.exe.

runs start-up stacks inside the arena in [0x7FFFFC000, 0x1000000000) highest host region
main 4,000 3,940, spread evenly from 4 to 1,008 GiB 139 1,008 GiB
this change 1,000 0 0 0.053 GiB

Full suite: all 4,945 tests, 4 at a time, with the GPU tests on the RX 6750 XT (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1). Nothing fails that passed in a run of main 41b9e25 without the change on this machine.

  • Five fail in both runs. vulkan_validation_gate_commands and the three guest_job_manager_worker_spin* tests are fixed on main since 41b9e25, by #16558 and e8a78de717. agc_driver_sample_order_grid_reference is addressed by #9503.
  • guest_kernel_sys_aio, public_headers_compile_46 and public_headers_compile_62 timed out in the main run and passed here. They also pass alone on main, so this change doesn't explain them.

Crash reproduced deliberately. Starting the test suspended and placing a stack-shaped 2 MiB region at 0xfe0000000 before its loader runs reproduces the message exactly, 3 of 3 times. The issue has the details and the injector.

No validation-layer run: only test link options change here, with no driver, recompiler or VideoOut code, and the Khronos layer is not installed on this machine.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none. #17778 changes the line above in add_test_executable; a trial merge of both is clean.
  • Fixes: #18252
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6750 XT, AMD Software Adrenalin 26.10.1 (32.0.21045.16010), Windows 10 22H2
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5251329799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18253). Originally posted by [angrysandhill](https://github.com/angrysandhill) on 2026-11-11T00:21:49Z. --- ### What Link the Windows test executables with `--disable-high-entropy-va`, the address-space layout the relinker already gives titles. With MinGW's default `HIGH_ENTROPY_VA`, Windows places the stacks of a test process's start-up threads anywhere from 4 GiB to past 1 TiB. These are the main thread and the loader's worker threads. So they sit inside the guest arena range in almost every run. Each is a 2 MiB reservation on a 2 MiB boundary. When one lands on the AGC driver memory at `0xfe0000000`, driver start-up fails with `replace guest placeholder with private memory: Attempt to access invalid address` (#18252). - `add_test_executable`: adds the flag for every test executable it makes. - `guest_video_out_wqhd_detection_exit_tests`: built with `add_executable` so that DLL teardown runs without `--wrap=main`. It loads libc, so it gets the same flag. - `agc_driver_frame_replay_relaunch_tests`: drops its own `-Wl,--disable-high-entropy-va`, which the helper now covers. #679 made the same change for titles: the relinker writes them without `HIGH_ENTROPY_VA` (`0x140` or `0x100` in `WindowsPeWriter.cpp`), and `test_windows_address_space.py` checks that a title's main thread stack stays below `0x200000000`. This applies it to the test executables. The trade-off is the one #679 describes: stacks and heaps keep 8-bit bottom-up randomization near the bottom of the address space, and images are still relocated. ### Tested **Setup:** Windows 10 Home 22H2 (10.0.19045), AMD Radeon RX 6750 XT, AMD Software Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2.0 r7 UCRT, Release, `BUILD_TESTING=ON`. Built on `main` `41b9e25` with this change. The branch is based on `b1f8766e5f`, and the three changed spots are identical there. **Flags:** with the change, `objdump -p` shows `HIGH_ENTROPY_VA` on none of the 2,437 executables under `build/tests`. **Where host memory sits at libc load.** These numbers come from a local libc build that printed the guest arena's host holes and exited; that build is not part of this PR. Each run was `agc_driver_draw_cache_reuse_tests.exe`. | | runs | start-up stacks inside the arena | in `[0x7FFFFC000, 0x1000000000)` | highest host region | |---|---|---|---|---| | `main` | 4,000 | 3,940, spread evenly from 4 to 1,008 GiB | 139 | 1,008 GiB | | this change | 1,000 | 0 | 0 | 0.053 GiB | **Full suite:** all 4,945 tests, 4 at a time, with the GPU tests on the RX 6750 XT (`ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`). Nothing fails that passed in a run of `main` `41b9e25` without the change on this machine. - Five fail in both runs. `vulkan_validation_gate_commands` and the three `guest_job_manager_worker_spin*` tests are fixed on `main` since `41b9e25`, by #16558 and `e8a78de717`. `agc_driver_sample_order_grid_reference` is addressed by #9503. - `guest_kernel_sys_aio`, `public_headers_compile_46` and `public_headers_compile_62` timed out in the `main` run and passed here. They also pass alone on `main`, so this change doesn't explain them. **Crash reproduced deliberately.** Starting the test suspended and placing a stack-shaped 2 MiB region at `0xfe0000000` before its loader runs reproduces the message exactly, 3 of 3 times. The issue has the details and the injector. **No validation-layer run:** only test link options change here, with no driver, recompiler or VideoOut code, and the Khronos layer is not installed on this machine. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none. #17778 changes the line above in `add_test_executable`; a trial merge of both is clean. - [x] Fixes: #18252 - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 6750 XT, AMD Software Adrenalin 26.10.1 (32.0.21045.16010), Windows 10 22H2 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-11 00:33:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-11T00:33:08Z.

Review: COMMENTED


Reviewed — no blocking findings

I found no blocking issue in the CMake changes; the Windows and Windows relinker checks are still pending, so this is a comment rather than an approval.

What I ran

Head 977dd8053e21655af6a6d8b5d6e5f17ccfdd755d; base 233c1606c46804b83e3f06f5bf8f376b8f8e07a8. The merge preview was clean and both revisions remained unchanged during the precheck. Environment: Linux 6.1, Python 3.11.2, GCC 12.2.0.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 18253 --output-dir /tmp/anyps5-pr-precheck-18253-current
gh pr checks 18253 -R boykopovar/AnyPS5

Results

Check Result Evidence
Diff check Passed git diff --check on the pinned base and head.
Conventions Passed All conventions checks passed.
Mergeability Passed Precheck produced a clean merge preview.
Test-quality heuristic Passed No findings.
Windows and Windows relinker Pending GitHub checks have not completed.
Linux/macOS relinker and relinker ASAN Passed Current GitHub checks.
Other product jobs Skipped These jobs provide no test evidence.

Negative control

Assertion Change Result
The startup issue reproduces without the linker option Author reports testing unmodified main Reported 3/3 reproductions; I did not run this control.

Findings

Blocking

None found in the reviewed diff.

Non-blocking

The Windows and Windows relinker checks remain pending. The PR changes the MinGW test executable link options, so those results are relevant before approval.

Sources

Not verified

I did not run a local build or CTest, and I did not reproduce the reported Windows startup failure. The author’s Windows build and negative-control results are reported evidence, not runs performed here. The hosted Windows checks are pending; skipped jobs do not verify behavior.

To get this to a good state

No code change is requested from this review. Once the Windows checks finish, I can re-check their result against this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5851703825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18253#pullrequestreview-5851703825). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-11T00:33:08Z. **Review:** COMMENTED --- # Reviewed — no blocking findings I found no blocking issue in the CMake changes; the Windows and Windows relinker checks are still pending, so this is a comment rather than an approval. ## What I ran Head `977dd8053e21655af6a6d8b5d6e5f17ccfdd755d`; base `233c1606c46804b83e3f06f5bf8f376b8f8e07a8`. The merge preview was clean and both revisions remained unchanged during the precheck. Environment: Linux 6.1, Python 3.11.2, GCC 12.2.0. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 18253 --output-dir /tmp/anyps5-pr-precheck-18253-current gh pr checks 18253 -R boykopovar/AnyPS5 ``` ## Results | Check | Result | Evidence | |---|---|---| | Diff check | Passed | `git diff --check` on the pinned base and head. | | Conventions | Passed | `All conventions checks passed.` | | Mergeability | Passed | Precheck produced a clean merge preview. | | Test-quality heuristic | Passed | No findings. | | Windows and Windows relinker | Pending | GitHub checks have not completed. | | Linux/macOS relinker and relinker ASAN | Passed | Current GitHub checks. | | Other product jobs | Skipped | These jobs provide no test evidence. | ## Negative control | Assertion | Change | Result | |---|---|---| | The startup issue reproduces without the linker option | Author reports testing unmodified `main` | Reported 3/3 reproductions; I did not run this control. | ## Findings ### Blocking None found in the reviewed diff. ### Non-blocking The Windows and Windows relinker checks remain pending. The PR changes the MinGW test executable link options, so those results are relevant before approval. ## Sources - [PR diff at reviewed head](https://github.com/boykopovar/AnyPS5/pull/18253/files/977dd8053e21655af6a6d8b5d6e5f17ccfdd755d) - [Root MinGW test executable helper at reviewed head](https://github.com/boykopovar/AnyPS5/blob/977dd8053e21655af6a6d8b5d6e5f17ccfdd755d/CMakeLists.txt) - [VideoOut test target at reviewed head](https://github.com/boykopovar/AnyPS5/blob/977dd8053e21655af6a6d8b5d6e5f17ccfdd755d/core/libs/prx/libSceVideoOut/CMakeLists.txt) ## Not verified I did not run a local build or CTest, and I did not reproduce the reported Windows startup failure. The author’s Windows build and negative-control results are reported evidence, not runs performed here. The hosted Windows checks are pending; skipped jobs do not verify behavior. ## To get this to a good state No code change is requested from this review. Once the Windows checks finish, I can re-check their result against this head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!18253
No description provided.