shader: fix ASTRO BOT (PPSA21567) startup crash on a null SRT table pointer #1528
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1528
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1528/head"
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?
@MIKL99999 on GitHub · 2026-10-15 15:26 UTC · original
MIKL99999:claude/fix-ppsa21567-crash-t3xfx8→main· +108 −8 · 4 files · 3 commits · closed without mergingGame: ASTRO BOT (PPSA21567, EU, v1.018)
Problem: The game crashed right at startup, after compiling its first shaders, with
Unhandled host exception ... address=0x0000000000000018on build KytyPS5-2026-10-12-df5b9b9. Full log attached. TheruntimeLinker.cpp:711line in the log is only where the crash gets reported.Cause: Before compiling a shader, the SRT walker reads the shader's resource tables to find out which buffers and textures it uses. When it can't decide a branch in advance, it walks both sides. On one side the table pointer is null, so
SrtReadCapture::ReadOrdinary(called fromSrtWalker::EvaluateRawRead) copied from address 0x18 and crashed.Fix: Ordinary SRT reads below 64 KiB, where nothing is ever mapped, now return zero instead of reading host memory, and they are not recorded as specialization reads. The compiled (JIT) walker also bails out on such tables and falls back to the interpreted walk. That part is hardening; it was not on the crash path.
Trade-off: if the GPU really takes the branch with the null table, its descriptors come out empty (empty buffer or null image), so rendering could be wrong there, but it no longer crashes.
Testing:
tests/ResourceMaterializationTests.cpp. Run locally on Linux.AI use: Claude (Anthropic) found the cause from the crash log, wrote the fix and the tests. I tested the build in the game on Windows and reviewed the change before opening this PR.
@coderabbitai[bot] on GitHub · 2026-10-15 15:30 UTC · original · edited 2026-10-15 22:36 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
39435268-c5e0-48ac-afe2-e05dc3f04d48📥 Commits
Reviewing files that changed from the base of the PR and between
4d7110b43candbd8f0dae50.📒 Files selected for processing: 3
src/graphics/shader/recompiler/ir/passes/SrtWalker.cppsrc/graphics/shader/recompiler/ir/passes/SrtWalker.htests/ScalarProvenanceTests.cpp🚧 Files skipped from review as they are similar to previous changes: 2
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
The SRT walker uses
0x40000as the guest-memory threshold. Reads below the threshold produce zero in ordinary and raw-read paths under the described reader conditions. The compiled walker falls back for table pointers below the threshold, adjusted for negative offsets. When compiled walking returns false,RefreshFlatBuffercontinues with interpreted evaluation. Tests cover direct, captured, nested, and compiled SRT reads through null pointers.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
bd8f0Null-table reads now resolve safely, and the fallback refreshes results after compiled-walk failure. No identified merge blocker remains.
Pre-merge checks:
4 ·
1
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
Comment
@coderabbitai helpto get the list of available commands.@Nawid3333 on GitHub · 2026-10-15 18:48 UTC · original
I checked this with a CPU test in
tests/ScalarProvenanceTests.cpp(Windows 11, clang-cl 19.1.5, Release). User data holds a zero table pointer and the test reads through it three ways: a capture walk (SrtReadCapture, soReadOrdinary),SrtWalker::Evaluate(EvaluateRawRead), andRefreshFlatBufferwith no reader, which runs the compiled walker. I ran each of the three checks on its own:+0x18(the Astro Bot case): on9e41d832each check faults (0xC0000005); with this PR the test passes.+0x20000: with this PR each check still faults. Herefirst >= NULL_PAGE_END, so the new JIT check isn't emitted and the table load runs on the null pointer, and the interpreter guards (address < NULL_PAGE_END) let the read through tomemcpy.Guest memory starts at
0x40000(HOST_SYSTEM_MANAGED_MINinmemoryAddressSpace.inc), so nothing below that can be guest data. A variant that compares the table pointer itself against0x40000in the compiled walker, right afterand rdi, r9and before the range checks, uses0x40000as the interpreter threshold, and doesn't record those reads passes the test at both offsets:github.com/Nawid3333/KytyPS5@df55cb78. I haven't seen offsets that large in the Astro Bot logs, so this is an edge case, not a blocker.Test (Fixture maps s2/s3 to user_data[0..1], user_data_base = 2)
AI use: Claude Code wrote the test and the variant, ran them on my machine and wrote this comment.
@coderabbitai[bot] on GitHub · 2026-10-15 22:24 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
6a796c68-9638-48f6-9b68-2a316c9251f6📥 Commits
Reviewing files that changed from the base of the PR and between
e28ca2b937and4d7110b43c.📒 Files selected for processing: 2
src/graphics/shader/recompiler/ir/passes/SrtWalker.cpptests/ScalarProvenanceTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@ -38,6 +47,9 @@ bool SrtReadCapture::ReadOrdinary(void* userdata, uint64_t address, std::span<uiauto& capture = *static_cast<SrtReadCapture*>(userdata);if (capture.m_source.read_memory != nullptr) {if (!capture.m_source.read_memory(capture.m_source.userdata, address, values)) return false;} else if (address < GUEST_MEMORY_MIN) {@coderabbitai[bot] on GitHub · 2026-10-15 22:24 UTC · original · edited 2026-10-15 22:31 UTC
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9485
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 26395
Guard the table base before dispatching the captured read.
For
base == 0and an offset of at least0x40000,EvaluateRawReadcomputes a final address that passesSrtReadCapture::ReadOrdinary's check. The callback then performsmemcpyand records the range. This can fault on an unmapped host address or record an invalid specialization range.The captured path does not use the compiled walker because
ObservedRuntimeinstallsReadOrdinary. Add the base check before invoking the reader:Suggested fix
✅ Addressed in commit
bd8f0da@Nawid3333 on GitHub · 2026-10-16 18:21 UTC · original
The JIT part of this PR is on a crash path too, not only hardening: Star Wars: Galactic Racer (#1481, official build
df5b9b9) crashes in code generated at runtime, at0x100b1dac020, withrdi = 0. The bytes around the fault,55 48 89 e5 49 83 f8 06 0f 82 2a 00 00 00 49 b9 fc ff ff ff ff ff 00 00 57 48 8b 7f 10 4c 21 cf | 44 8b 17 44 89 16 4c 89 12 48 89 4a 08 5f, arewhich is what
CompileSrtWalkeremits for a table whose pointer is user-data dwords 4-5, with one read at offset 0 (SrtWalker.cpp:447-484on main, the same indf5b9b9). That pointer is 0 after the mask, and the compiled walk reads through it: its only pointer checks are for address wrap-around (first < 0,last > 0), so for a single read at offset 0 it emits none. With this PR (bd8f0dae) the compiled walk compares the table pointer with0x40000and falls back to the interpreted walk, which doesn't dereference such a pointer, so #1481 should get past this point as well (not tested, I don't have the game).Written with Claude Code (AI): it decoded the bytes from the log and matched them to the source; I read this comment before posting it.
@Nawid3333 on GitHub · 2026-10-21 17:13 UTC · original
A/B on current main, ASTRO BOT (PPSA21564, 01.007.000), Windows 11, RX 9070 XT. Both builds are main
4644c529plus two lab commits of mine that play scripted gamepad input (the same in both), one of them with this PR's three commits cherry-picked unchanged (they still apply cleanly):Unhandled host exception: type=1 code=3221225477 pc=0x00007ffcbf6cc12a access=1 address=0x0000000000000058, right after the recompiler built a shader that loads an image descriptor through an address resource. The fault pc ends in the same…c12aas the ASTRO BOT reports #1623 and #1675 (address 0x18 there).The same A/B on main
0cad4672on 10-20 gave the same result (crash at 14 s without this PR, the full 5 minutes with it).Pull request closed