tests: read the fake SRT table from address space the test reserved #2205

Open
github-bot wants to merge 2 commits from github-bot/gh-2205 into main AGit
Owner

@⁠Nawid3333 on GitHub · 2026-11-11 02:14 UTC · original
Nawid3333:tests/srt-fake-address-space → main · +49 −8 · 2 files · 2 commits · open

shader_cfg_tests aborts on the macOS CI runner on current main (7d4e0d9) in TestGpuProducedWritableDescriptor:

ShaderCfgTests: failed: GPU-produced descriptor lost current scalar data or repeated its reads

CI does not build or run this suite, so nothing shows it. I ran it on a fork branch that only adds the target to the three build lists and the name to the three ctest selections: Windows and Linux pass, macOS (x86_64 build on the arm64 runner) aborts: https://github.com/Nawid3333/KytyPS5/actions/runs/42924937076

Cause. The test lets the SRT walker load from the fake addresses 0x300315028, 0x30031502c and 0x300315074, and FakeGuestMemory supplies the words from its fault handler. That only works while nothing is mapped there. A second fork run printed the state right before the failing check (https://github.com/Nawid3333/KytyPS5/actions/runs/42930092568, macOS job):

[diag] want=003176c0 00800003 00000097 00016204 reads_expected=3 reads=0 buffers=1 captured=0
[diag] got =00315000 00800003 00000000 00016204
[diag] vm kr=0 region=300040000 bytes=8000000 prot=3 covers_fake_address_readable=1
[diag] words at the fake addresses: 00000000 00000000 00000000

On that runner 0x300040000 to 0x308040000 is mapped read/write, so the loads succeed, the handler is never called (reads=0) and the walker reads zeros. The walker and the fault resume are not involved.

Change. FakeGuestAddressSpace (tests/SrtWalkerTestMemory.h) reserves 8 GiB without access (mmap PROT_NONE, VirtualAlloc MEM_RESERVE) and returns the address inside it whose low word is the one the test was reduced with (0x00315000). The test takes its table address from there: the high word of the address comes from the host instead of the constant 3, the expected descriptor high words are the stride bit with that high word (plus one in the carry case), and the reader compares offsets from the table. No product code changes.

Testing. Fork run with this commit and the same CI-only change as above: shader_cfg passes on Windows, Linux and macOS (on macOS the tests after this one had not run in the earlier runs): https://github.com/Nawid3333/KytyPS5/actions/runs/42933711408

On a physical Mac: Fr0gzilla ran it on an Apple M5 (macOS 26.6, x86_64 build under Rosetta 2) on current main 39936ff (comment). Without this PR shader_cfg_tests aborts at the same check; with it, applied cleanly onto 39936ff, it passes in 3 of 3 runs and ctest -R '^shader_cfg$' passes.

Other tests use FakeGuestMemory with fixed addresses as well; those that CI and this run cover pass on the three runners and are not touched here.

If you want CI to run shader_cfg_tests from now on, I can add the workflow lines to this PR or send them separately.

Written with Claude Code, OpenAI Codex and GLM (AI): the diagnosis, the change and the fork CI runs; reviewed by me.

**@⁠Nawid3333** on GitHub · 2026-11-11 02:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2205) `Nawid3333:tests/srt-fake-address-space` → `main` · +49 −8 · 2 files · 2 commits · open `shader_cfg_tests` aborts on the macOS CI runner on current main (7d4e0d9) in `TestGpuProducedWritableDescriptor`: ``` ShaderCfgTests: failed: GPU-produced descriptor lost current scalar data or repeated its reads ``` CI does not build or run this suite, so nothing shows it. I ran it on a fork branch that only adds the target to the three build lists and the name to the three `ctest` selections: Windows and Linux pass, macOS (x86_64 build on the arm64 runner) aborts: https://github.com/Nawid3333/KytyPS5/actions/runs/42924937076 **Cause.** The test lets the SRT walker load from the fake addresses `0x300315028`, `0x30031502c` and `0x300315074`, and `FakeGuestMemory` supplies the words from its fault handler. That only works while nothing is mapped there. A second fork run printed the state right before the failing check (https://github.com/Nawid3333/KytyPS5/actions/runs/42930092568, macOS job): ``` [diag] want=003176c0 00800003 00000097 00016204 reads_expected=3 reads=0 buffers=1 captured=0 [diag] got =00315000 00800003 00000000 00016204 [diag] vm kr=0 region=300040000 bytes=8000000 prot=3 covers_fake_address_readable=1 [diag] words at the fake addresses: 00000000 00000000 00000000 ``` On that runner `0x300040000` to `0x308040000` is mapped read/write, so the loads succeed, the handler is never called (`reads=0`) and the walker reads zeros. The walker and the fault resume are not involved. **Change.** `FakeGuestAddressSpace` (tests/SrtWalkerTestMemory.h) reserves 8 GiB without access (`mmap` `PROT_NONE`, `VirtualAlloc` `MEM_RESERVE`) and returns the address inside it whose low word is the one the test was reduced with (`0x00315000`). The test takes its table address from there: the high word of the address comes from the host instead of the constant 3, the expected descriptor high words are the stride bit with that high word (plus one in the carry case), and the reader compares offsets from the table. No product code changes. **Testing.** Fork run with this commit and the same CI-only change as above: `shader_cfg` passes on Windows, Linux and macOS (on macOS the tests after this one had not run in the earlier runs): https://github.com/Nawid3333/KytyPS5/actions/runs/42933711408 On a physical Mac: Fr0gzilla ran it on an Apple M5 (macOS 26.6, x86_64 build under Rosetta 2) on current main 39936ff ([comment](https://git.gtahub.st/github/KytyPS5--KytyPS5/pulls/2205)). Without this PR `shader_cfg_tests` aborts at the same check; with it, applied cleanly onto 39936ff, it passes in 3 of 3 runs and `ctest -R '^shader_cfg$'` passes. Other tests use `FakeGuestMemory` with fixed addresses as well; those that CI and this run cover pass on the three runners and are not touched here. If you want CI to run `shader_cfg_tests` from now on, I can add the workflow lines to this PR or send them separately. Written with Claude Code, OpenAI Codex and GLM (AI): the diagnosis, the change and the fork CI runs; reviewed by me.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:16:47 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-11 02:21 UTC · original · edited 2026-11-23 17:03 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The test memory helper now reserves and releases a platform-specific fake guest address range. The shader configuration test derives its table address from that range, reads fake memory by offsets from the table address, and checks descriptor high-word calculations, including a carry after the low address changes.

Suggested reviewers: nmzik

Change: Other

Merge Risk: Minimal · up to 5b5bc

This change makes a shader configuration test portable to macOS by reserving an inaccessible fake address range. It touches only tests, so production behavior is unaffected, and merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the fake SRT table is now read from an address range the test reserves. The changeset adds FakeGuestAddressSpace and changes the test to take its table address from th…
Description check Passed The description explains the failure on the macOS runner, gives the diagnostic output, and describes the fix: reserving an inaccessible 8 GiB range and deriving the table address and expected high wor…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the fake SRT table is now read from an address range the test reserves. The changeset adds FakeGuestAddressSpace and changes the test to take its table address from that reservation, so the title matches the primary change. It is specific and uses the test-scope prefix.

Full details: Description check

Explanation

The description explains the failure on the macOS runner, gives the diagnostic output, and describes the fix: reserving an inaccessible 8 GiB range and deriving the table address and expected high words from it. It also reports fork CI and physical Mac test results. It relates directly to the changeset.

Warning

Some tools did not complete. Review the errors below.

Cppcheck (2.22.0)

Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.

tests/shaderCfgTests.cpp

Cppcheck interrupted; analysis of this file is incomplete

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3d9efdcddd and 5b5bc9f69a.

Files selected for processing: 2

  • tests/SrtWalkerTestMemory.h
  • tests/shaderCfgTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-11 02:21 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2205#issuecomment-6785108612) · edited 2026-11-23 17:03 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2205?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The test memory helper now reserves and releases a platform-specific fake guest address range. The shader configuration test derives its table address from that range, reads fake memory by offsets from the table address, and checks descriptor high-word calculations, including a carry after the low address changes. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"5b5bc9f69a2d246e2944d5f80ccb1777de8f069a" --> <!-- change_assessment_priority:{"version":1,"urgency":"p3","manual":false} --> **Change:** Other <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>5b5bc</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `5b5bc` --> <!-- final_review_risk_coverage:{"sourceCommitId":"5b5bc9f69a2d246e2944d5f80ccb1777de8f069a","coveredCommitId":"5b5bc9f69a2d246e2944d5f80ccb1777de8f069a","kind":"reviewed"} --> This change makes a shader configuration test portable to macOS by reserving an inaccessible fake address range. It touches only tests, so production behavior is unaffected, and merge risk is minimal. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: the fake SRT table is now read from an address range the test reserves. The changeset adds FakeGuestAddressSpace and changes the test to take its table address from th… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the failure on the macOS runner, gives the diagnostic output, and describes the fix: reserving an inaccessible 8 GiB range and deriving the table address and expected high wor… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: the fake SRT table is now read from an address range the test reserves. The changeset adds FakeGuestAddressSpace and changes the test to take its table address from that reservation, so the title matches the primary change. It is specific and uses the test-scope prefix. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description explains the failure on the macOS runner, gives the diagnostic output, and describes the fix: reserving an inaccessible 8 GiB range and deriving the table address and expected high words from it. It also reports fork CI and physical Mac test results. It relates directly to the changeset. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- operational_warnings_start --> <!-- This is an auto-generated comment: all tool run failures by coderabbit.ai --> > [!WARNING] > Some tools did not complete. Review the errors below. > > <details> > <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/wrench-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/wrench.svg" width="16" height="16" align="absmiddle" alt=""></picture> Cppcheck (2.22.0)</strong></summary> > <dl> > <dd> > <br> > > Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete. > > <details> > <summary><strong>tests/shaderCfgTests.cpp</strong></summary> > <dl> > <dd> > <br> > > Cppcheck interrupted; analysis of this file is incomplete > > </dd> > </dl> > </details> > > </dd> > </dl> > </details> <!-- end of auto-generated comment: all tool run failures by coderabbit.ai --> <!-- operational_warnings_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2205)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/578f2d43fe5d018617afaad94b1c90a07f6d9acc/.coderabbit.yaml>) - **Commit**: [578f2d4](<https://github.com/KytyPS5/KytyPS5/commit/578f2d43fe5d018617afaad94b1c90a07f6d9acc>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `628dec8d-9714-425f-a45a-5ec6942f3ca1` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 3d9efdcddd87dbb76704fbd3933b1633aaeaaa8a and 5b5bc9f69a2d246e2944d5f80ccb1777de8f069a. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</strong></summary> <dl> <dd> <br> * `tests/SrtWalkerTestMemory.h` * `tests/shaderCfgTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠Fr0gzilla on GitHub · 2026-11-21 13:32 UTC · original

Tested on real hardware: Apple M5, macOS 26.6 (25G72), x86_64 build under Rosetta 2.

On current main (39936ff), shader_cfg_tests still aborts at the same check:

ShaderCfgTests: failed: GPU-produced descriptor lost current scalar data or repeated its reads

This PR still applies cleanly onto 39936ff (145 commits after its base). With it, shader_cfg_tests passes in 3 out of 3 runs, and ctest -R '^shader_cfg$' passes:

1/1 Test #6: shader_cfg .......................   Passed    0.75 sec

So the fix holds on a physical Mac too, not only on the CI runner.

AI disclosure: I used an AI assistant to build, run the tests and read the logs; I checked the results myself on my Mac.

**@⁠Fr0gzilla** on GitHub · 2026-11-21 13:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2205#issuecomment-7063362112) Tested on real hardware: Apple M5, macOS 26.6 (25G72), x86_64 build under Rosetta 2. On current main (39936ff), `shader_cfg_tests` still aborts at the same check: ``` ShaderCfgTests: failed: GPU-produced descriptor lost current scalar data or repeated its reads ``` This PR still applies cleanly onto 39936ff (145 commits after its base). With it, `shader_cfg_tests` passes in 3 out of 3 runs, and `ctest -R '^shader_cfg$'` passes: ``` 1/1 Test #6: shader_cfg ....................... Passed 0.75 sec ``` So the fix holds on a physical Mac too, not only on the CI runner. AI disclosure: I used an AI assistant to build, run the tests and read the logs; I checked the results myself on my Mac.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2205/head:github-bot/gh-2205'
git switch 'github-bot/gh-2205'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2205'
git switch 'github-bot/gh-2205'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2205'
git switch 'github-bot/gh-2205'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2205'
git switch 'main'
git merge --squash 'github-bot/gh-2205'
git switch 'main'
git merge --ff-only 'github-bot/gh-2205'
git switch 'main'
git merge 'github-bot/gh-2205'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.