shader: read BDA pages past the page table as missing #2358

Open
github-bot wants to merge 1 commit from github-bot/gh-2358 into main AGit
Owner

@⁠wuboo on GitHub · 2026-11-17 18:40 UTC · original
wuboo:pr/bda-page-guard → main · +113 −5 · 2 files · 1 commits · open

Problem

get_bda_pointer (DefineGetBdaPointer in spirvEmitterMemory.cpp) narrows the 64-bit guest page number to 32 bits and uses it, unchecked, to index the BDA page table and the fault bitmap. The table holds CACHING_NUMPAGES = (2^40 + 512 GiB) >> 14 = 100,663,296 entries. A guest address whose packed page is outside the table causes two problems:

  • it indexes both storage buffers out of bounds. With robustBufferAccess, which the device always enables, this does not lose the device. But the value read is only guaranteed to be zero with robustBufferAccess2; core robustness allows any value from inside the buffer, which is a device address of an unrelated page;
  • from a packed address of 2^46 on, the 32-bit narrowing wraps the page onto a valid lower page. That entry is in bounds, so the shader silently reads and writes the wrong guest page, whatever the robustness level.

Cause

page = OpUConvert(u32, packed >> CACHING_PAGEBITS) has no range check, and the fault path records the narrowed page as well.

Fix

Compare the 64-bit page with CACHING_NUMPAGES before narrowing it. A page outside the table uses index 0 for the (now in-bounds) table load and goes down the existing "unbacked" path, so it reads as zero. The fault bit is only recorded for in-range pages, so a garbage address never marks page 0 as faulting.

Testing

  • TestNewShaderRecompilerUnbasedFlatUsesBda now also checks the disassembled get_bda_pointer. The function must compare the page with the CACHING_NUMPAGES constant (OpULessThan) and have the nested selection that skips the fault record. The SPIR-V still validates.
  • Mutation check: with the emitter change reverted, the test fails with "BDA page lookup did not treat pages past the table as missing".
  • macOS (x86_64 build): ctest gives the same result set as main (guest_red_zone_patcher aborted once under -j6 and passed 3/3 when rerun alone; it does not touch this code).
  • ASTRO BOT on Windows 11, Ryzen 7 5700X, Radeon RX 9060 XT, both builds on top of the PS logo fix, same replayed input: 4 runs without this change and 3 with it, plus 2 with it and the file-read fix (#2356). The game behaves the same with and without the change: the same loader stops, at the same guest pc, without the file-read fix, and no device loss in any run. With the file-read fix, a 19,500-frame run on the first planet completed without errors. This PR does not fix a crash I can reproduce in the game; it is a correctness fix for out-of-range guest addresses.

AI use & testing

I used AI coding assistants to help review the page-table lookup, draft the change and write the unit test check. I reviewed every line of the diff myself and I am responsible for it.

Testing:

  • Game: ASTRO BOT (PS logo, title screen, world map), compared with and without the change on the same replayed input: no difference and no device loss in either.
  • Hardware: Windows 11, Ryzen 7 5700X, Radeon RX 9060 XT (AMD Vulkan driver).
  • Unit test: SPIR-V check in TestNewShaderRecompilerUnbasedFlatUsesBda, including a mutation check that fails when the fix is reverted.
**@⁠wuboo** on GitHub · 2026-11-17 18:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2358) `wuboo:pr/bda-page-guard` → `main` · +113 −5 · 2 files · 1 commits · open ## Problem `get_bda_pointer` (`DefineGetBdaPointer` in `spirvEmitterMemory.cpp`) narrows the 64-bit guest page number to 32 bits and uses it, unchecked, to index the BDA page table and the fault bitmap. The table holds `CACHING_NUMPAGES` = (2^40 + 512 GiB) >> 14 = 100,663,296 entries. A guest address whose packed page is outside the table causes two problems: - it indexes both storage buffers out of bounds. With `robustBufferAccess`, which the device always enables, this does not lose the device. But the value read is only guaranteed to be zero with `robustBufferAccess2`; core robustness allows any value from inside the buffer, which is a device address of an unrelated page; - from a packed address of 2^46 on, the 32-bit narrowing wraps the page onto a valid lower page. That entry is in bounds, so the shader silently reads and writes the wrong guest page, whatever the robustness level. ## Cause `page = OpUConvert(u32, packed >> CACHING_PAGEBITS)` has no range check, and the fault path records the narrowed page as well. ## Fix Compare the 64-bit page with `CACHING_NUMPAGES` before narrowing it. A page outside the table uses index 0 for the (now in-bounds) table load and goes down the existing "unbacked" path, so it reads as zero. The fault bit is only recorded for in-range pages, so a garbage address never marks page 0 as faulting. ## Testing - `TestNewShaderRecompilerUnbasedFlatUsesBda` now also checks the disassembled `get_bda_pointer`. The function must compare the page with the `CACHING_NUMPAGES` constant (`OpULessThan`) and have the nested selection that skips the fault record. The SPIR-V still validates. - Mutation check: with the emitter change reverted, the test fails with "BDA page lookup did not treat pages past the table as missing". - macOS (x86_64 build): `ctest` gives the same result set as `main` (`guest_red_zone_patcher` aborted once under `-j6` and passed 3/3 when rerun alone; it does not touch this code). - ASTRO BOT on Windows 11, Ryzen 7 5700X, Radeon RX 9060 XT, both builds on top of the PS logo fix, same replayed input: 4 runs without this change and 3 with it, plus 2 with it and the file-read fix (#2356). The game behaves the same with and without the change: the same loader stops, at the same guest pc, without the file-read fix, and no device loss in any run. With the file-read fix, a 19,500-frame run on the first planet completed without errors. This PR does not fix a crash I can reproduce in the game; it is a correctness fix for out-of-range guest addresses. ### AI use & testing I used AI coding assistants to help review the page-table lookup, draft the change and write the unit test check. I reviewed every line of the diff myself and I am responsible for it. Testing: - Game: ASTRO BOT (PS logo, title screen, world map), compared with and without the change on the same replayed input: no difference and no device loss in either. - Hardware: Windows 11, Ryzen 7 5700X, Radeon RX 9060 XT (AMD Vulkan driver). - Unit test: SPIR-V check in `TestNewShaderRecompilerUnbasedFlatUsesBda`, including a mutation check that fails when the fix is reverted.
get_bda_pointer narrowed the 64-bit page number to 32 bits and indexed the
page table and the fault bitmap with it unchecked. A guest address past the
end of the table indexed both out of bounds, and from a packed address of
2^46 on the page wrapped onto a lower one and returned that page's device
address. Such a page now reads as zero, like an unbacked page, and records
no fault.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:18:47 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 18:45 UTC · original · edited 2026-11-24 23:22 UTC

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 222c73dd4315080105c8a3dd2bb34c2170cd1731
  • Latest commit, not reviewed: 1fd31a4b8b

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

The generated SPIR-V get_bda_pointer function now checks the 64-bit guest page index against BufferCache::CACHING_NUMPAGES before narrowing it for page-table lookup. Out-of-range indices use index zero for lookup, are treated as unbacked, and return zero without recording a fault. In-range unbacked pages still record a fault and return zero. The shader configuration test checks the generated function for the bound comparison, index selection, and guarded fault-buffer uses.

Suggested reviewers: claxten10, nmzik, senaxx

Change: Bug fix

Merge Risk: Minimal · previous review 222c7

This change makes out-of-range guest page lookups read as missing instead of wrapping to a valid lower page or reading past the table. No concrete merge-blocking risk remains; the test could be tightened further but that is optional.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: BDA page lookups past the page table are now treated as missing (unbacked, zero). The raw summary and objectives confirm the change in DefineGetBdaPointer matches this…
Description check Passed The description explains the problem (unchecked 64-bit page narrowing indexing the BDA page table and fault bitmap), the cause, the fix (range check against CACHING_NUMPAGES before narrowing, index 0 …
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: BDA page lookups past the page table are now treated as missing (unbacked, zero). The raw summary and objectives confirm the change in DefineGetBdaPointer matches this title.

Full details: Description check

Explanation

The description explains the problem (unchecked 64-bit page narrowing indexing the BDA page table and fault bitmap), the cause, the fix (range check against CACHING_NUMPAGES before narrowing, index 0 with unbacked path), and the unit test changes. It is directly related to the changeset.

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 18:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2358#issuecomment-6957553776) · edited 2026-11-24 23:22 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/2358?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 --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > - Last reviewed commit: 222c73dd4315080105c8a3dd2bb34c2170cd1731 > - Latest commit, not reviewed: 1fd31a4b8b5b8227a29784365ae5d784843c9826 > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The generated SPIR-V `get_bda_pointer` function now checks the 64-bit guest page index against `BufferCache::CACHING_NUMPAGES` before narrowing it for page-table lookup. Out-of-range indices use index zero for lookup, are treated as unbacked, and return zero without recording a fault. In-range unbacked pages still record a fault and return zero. The shader configuration test checks the generated function for the bound comparison, index selection, and guarded fault-buffer uses. **Suggested reviewers:** `claxten10`, `nmzik`, `senaxx` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"222c73dd4315080105c8a3dd2bb34c2170cd1731" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- 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> · previous review <code>222c7</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `222c7` --> <!-- final_review_risk_coverage:{"sourceCommitId":"222c73dd4315080105c8a3dd2bb34c2170cd1731","coveredCommitId":"222c73dd4315080105c8a3dd2bb34c2170cd1731","kind":"reviewed"} --> This change makes out-of-range guest page lookups read as missing instead of wrapping to a valid lower page or reading past the table. No concrete merge-blocking risk remains; the test could be tightened further but that is optional. <!-- 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: BDA page lookups past the page table are now treated as missing (unbacked, zero). The raw summary and objectives confirm the change in DefineGetBdaPointer matches this… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the problem (unchecked 64-bit page narrowing indexing the BDA page table and fault bitmap), the cause, the fix (range check against CACHING_NUMPAGES before narrowing, index 0 … | | 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: BDA page lookups past the page table are now treated as missing (unbacked, zero). The raw summary and objectives confirm the change in DefineGetBdaPointer matches this title. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description explains the problem (unchecked 64-bit page narrowing indexing the BDA page table and fault bitmap), the cause, the fix (range check against CACHING_NUMPAGES before narrowing, index 0 with unbacked path), and the unit test changes. It is directly related to the changeset. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2358)! 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 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 18:46 UTC · original · reviewed

Nitpick comments: 1

tests/shaderCfgTests.cpp: 1

4477-4479: Trivial · Maintainability & Code Quality · Quick win

Check that the bounds predicate controls fault recording.

The assertion still passes if the nested fault condition becomes constant true. The comparison and both selection merges remain, but out-of-range lookups then record a fault for page zero.

Extend the check to follow the comparison result into the index selection and the fault-recording branch. This would protect the intended behavior rather than only the instruction counts.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4da95bd8d0 and 4fd0344a1bba92d3280a7425d06ed77d174543bc.

Files selected for processing: 2

  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • tests/shaderCfgTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 18:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2358#pullrequestreview-5944534227) · **reviewed** <!-- coderabbit-ai-generated:v1 --> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning.svg" width="16" height="16" align="absmiddle" alt=""></picture> Nitpick comments: 1</summary><blockquote> <dl> <dd> <br> <details> <summary>tests/shaderCfgTests.cpp: 1</summary><blockquote> <dl> <dd> <br> `4477-4479`: **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial** · **Maintainability & Code Quality** · **Quick win** **Check that the bounds predicate controls fault recording.** The assertion still passes if the nested fault condition becomes constant true. The comparison and both selection merges remain, but out-of-range lookups then record a fault for page zero. Extend the check to follow the comparison result into the index selection and the fault-recording branch. This would protect the intended behavior rather than only the instruction counts. <!-- cr-comment:v1:023506631cc98b6d4d6f1de0 --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><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</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/4da95bd8d0f389d168812b98e58791055912e880/.coderabbit.yaml>) - **Commit**: [4da95bd](<https://github.com/KytyPS5/KytyPS5/commit/4da95bd8d0f389d168812b98e58791055912e880>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `61ea1620-2f9b-4e20-b961-b95c929aa73a` </dd> </dl> </details> <details> <summary><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</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 4da95bd8d0f389d168812b98e58791055912e880 and 4fd0344a1bba92d3280a7425d06ed77d174543bc. </dd> </dl> </details> <details> <summary><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</summary> <dl> <dd> <br> * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `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; 7 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=20a48932-e8d4-4983-9c2e-457a9cdf3111 attempt=5ec36e2b-c395-407e-8e91-23afe480f9c6 batch=1/1 -->
Author
Owner

@⁠wuboo on GitHub · 2026-11-17 20:46 UTC · original

Re the test nitpick: updated. The test now follows the OpULessThan result into the OpSelect that picks the page table index, into the unbacked condition and into the nested branch. It also checks that fault_buffer is only accessed in the block that branch guards. A constant-true guard, a missing index select or a reverted emitter each fail it.

**@⁠wuboo** on GitHub · 2026-11-17 20:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2358#issuecomment-6960543459) Re the test nitpick: updated. The test now follows the `OpULessThan` result into the `OpSelect` that picks the page table index, into the unbacked condition and into the nested branch. It also checks that `fault_buffer` is only accessed in the block that branch guards. A constant-true guard, a missing index select or a reverted emitter each fail it.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 20:50 UTC · original · reviewed

Nitpick comments: 1

tests/shaderCfgTests.cpp: 1

4503-4504: Trivial · Maintainability & Code Quality · Quick win

Trace the comparison operand back to the original 64-bit page.

The test can still pass if the emitter compares uint64_t(uint32_t(page64)) against the bound. For page64 = 2^32 + 1, that comparison accepts page 1, and the selected index aliases page 1.

The supplied emitter is correct. Strengthen the test by capturing the comparison's left operand and checking its definition. Also check that the select's true operand converts that same original page value to %uint. This protects the pre-narrowing requirement, not only the presence of a 64-bit comparison.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4fd0344a1bba92d3280a7425d06ed77d174543bc and 37c7ab10990d4d38574700a8b094722e9bb7ff56.

Files selected for processing: 1

  • tests/shaderCfgTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 20:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2358#pullrequestreview-5946398736) · **reviewed** <!-- coderabbit-ai-generated:v1 --> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning.svg" width="16" height="16" align="absmiddle" alt=""></picture> Nitpick comments: 1</summary><blockquote> <dl> <dd> <br> <details> <summary>tests/shaderCfgTests.cpp: 1</summary><blockquote> <dl> <dd> <br> `4503-4504`: **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial** · **Maintainability & Code Quality** · **Quick win** **Trace the comparison operand back to the original 64-bit page.** The test can still pass if the emitter compares `uint64_t(uint32_t(page64))` against the bound. For `page64 = 2^32 + 1`, that comparison accepts page 1, and the selected index aliases page 1. The supplied emitter is correct. Strengthen the test by capturing the comparison's left operand and checking its definition. Also check that the select's true operand converts that same original page value to `%uint`. This protects the pre-narrowing requirement, not only the presence of a 64-bit comparison. <!-- cr-comment:v1:e006f3f8e86f2cd4221137bf --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><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</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/2638b1b07613dc32a4708d2cd61a75711b84b6cf/.coderabbit.yaml>) - **Commit**: [2638b1b](<https://github.com/KytyPS5/KytyPS5/commit/2638b1b07613dc32a4708d2cd61a75711b84b6cf>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `872d9a1b-19b2-4d87-80bc-13a09d4abb9d` </dd> </dl> </details> <details> <summary><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</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 4fd0344a1bba92d3280a7425d06ed77d174543bc and 37c7ab10990d4d38574700a8b094722e9bb7ff56. </dd> </dl> </details> <details> <summary><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: 1</summary> <dl> <dd> <br> * `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; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=3abb35ad-1b5b-469d-8019-b6a287386803 attempt=c73f410e-db14-4c5f-bdf9-f559260b5436 batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-24 20:15 UTC · original · reviewed

Nitpick comments: 1

tests/shaderCfgTests.cpp: 1

4528-4529: Trivial · Maintainability & Code Quality · Quick win

Connect the comparison to the original 64-bit page.

The comparison's left operand and the select's true operand are wildcards. If emission narrows the page and then widens it before comparison, these checks still pass. Packed page 2^32 then becomes page zero, recreating the aliasing failure this test targets.

Capture the original 64-bit page result. Require the comparison to consume that result directly. Also require the select's true operand to come from narrowing that same result. This preserves the current valid emission and rejects narrowing before comparison.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2c117b96b8981116405005a0c5e9bd049f3c53ee and 222c73dd4315080105c8a3dd2bb34c2170cd1731.

Files selected for processing: 1

  • 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-24 20:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2358#pullrequestreview-6046640783) · **reviewed** <!-- coderabbit-ai-generated:v1 --> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/brush-cleaning.svg" width="16" height="16" align="absmiddle" alt=""></picture> Nitpick comments: 1</summary><blockquote> <dl> <dd> <br> <details> <summary>tests/shaderCfgTests.cpp: 1</summary><blockquote> <dl> <dd> <br> `4528-4529`: **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/neutral-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Trivial** · **Maintainability & Code Quality** · **Quick win** **Connect the comparison to the original 64-bit page.** The comparison's left operand and the select's true operand are wildcards. If emission narrows the page and then widens it before comparison, these checks still pass. Packed page `2^32` then becomes page zero, recreating the aliasing failure this test targets. Capture the original 64-bit page result. Require the comparison to consume that result directly. Also require the select's true operand to come from narrowing that same result. This preserves the current valid emission and rejects narrowing before comparison. <!-- cr-comment:v1:71970e1a9e726f1211ae6d50 --> </dd> </dl> </blockquote></details> </dd> </dl> </blockquote></details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><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</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/30781dcda029cbd669aa81337ac2902c9c3015d8/.coderabbit.yaml>) - **Commit**: [30781dc](<https://github.com/KytyPS5/KytyPS5/commit/30781dcda029cbd669aa81337ac2902c9c3015d8>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `d3fc48be-623b-48e1-ad4f-df1f65f518a7` </dd> </dl> </details> <details> <summary><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</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 2c117b96b8981116405005a0c5e9bd049f3c53ee and 222c73dd4315080105c8a3dd2bb34c2170cd1731. </dd> </dl> </details> <details> <summary><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: 1</summary> <dl> <dd> <br> * `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> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=31de291a-18b0-4cd7-9c46-35ef7a3e5eae attempt=c871c37d-18a3-4690-b081-9c38029e1e66 batch=1/1 -->
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/2358/head:github-bot/gh-2358'
git switch 'github-bot/gh-2358'

Merge

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