Skip to content

Hades II (PPSA36082) crashes at start on Windows with the Kyty backend: null write in LoadTaskScheduler #219

Done

Description

@talha-devp

What happens

Hades II crashes before its first frame on AnyKyty under Windows, on every launch (7 of 7, with and without a replayed controller recording). The game's LoadTaskScheduler thread writes through a null pointer inside the guest libc's memcpy, right after the game opens /app0/Content/Game/GUI/Platform/PlayStation/LaunchScreen.sjson:

FATAL: unhandled exception 0xc0000005 on thread 16372 'LoadTaskScheduler'
  rip 0x00007ffb7ddf3fb0 libc.prx.guest.prx+0x13fb0
  write of 0x0000000000000000
  rax 0000000000000000 rbx 0000000000000000 rcx 0000000000000030 rdx 0000000000004000
  rsi 00000000015e2e2b rdi 0000000000000000 rbp 000000fd1858f130 rsp 000000fd1858f130
  frame pointer chain:
    #0 PPSA36082.exe+0x29fbae
    #1 PPSA36082.exe+0x29f775
    #2 PPSA36082.exe+0x29fecd
    #3 PPSA36082.exe+0x29fcdb
    #4 PPSA36082.exe+0x242e91
    #5 PPSA36082.exe+0x23f723
    #6 PPSA36082.exe+0x1e4166
    #7 PPSA36082.exe+0x27057d
    #8 PPSA36082.exe+0x6e5af
    #9 PPSA36082.exe+0x3eed1e
    #10 libkernel.prx+0x8885f

The other six launches stop at the same place (libc.prx.guest.prx+0x13fb0, once +0x13dba), with the same frame chain, rdi = 0 and a copy of about 16 KiB (rdx 0x3ff0 to 0x4000). Nothing about memory or mapping is logged before it. The process had about 3 GB committed, and Windows had about 11 GB of commit left.

Upstream AnyPS5 main 47139cd (default backend, same machine, same day) hit the same crash once in 8 launches: same rip, rdi = 0, rdx 0x4000, and the same game frames except one return address in the same caller (PPSA36082.exe+0x1e4138 instead of +0x1e4166); the other 7 played. So the race is probably not the Kyty core's alone, but the Kyty backend makes it certain here.

Call trace

Two more launches converted with --trace-imports and run with APS5_TRACE_CALLS=all, APS5_CRASH_INDIRECT_MEMORY=1 and APS5_CRASH_STACK_BYTES=4096 crash the same way (libc.prx.guest.prx+0x13fb0). The last 64 traced calls in both reports all come from one other game thread, which polls in a loop from PPSA36082.exe+0x3eeb4b..+0x3eebc9: libSceSaveDataDialog KK3Bdg1RWK0, libkernel -2IRUCO--PM and 1j3S3n-tTW4, libSceUserService yH17Q6NWtVg, about 69 to 117 million times each before the crash. So the ring holds nothing from LoadTaskScheduler. I have not checked whether upstream main polls the same way. The full reports (stack bytes and pointer contents included) are available.

Build

  • AnyKyty a4b4360d66 (AnyKyty branch), built as the Windows job of anykyty.yml does: WinLibs GCC 15.2.0 (15.2.0posix-14.0.0-ucrt-r7) and LLVM 21.1.8, Release, -DANYPS5_GPU_BACKEND=kyty -DBUILD_TESTING=OFF. ThinLTO off (the Windows default), PGO profile used. Targets kyty_gpu libs relinker.
  • No KYTY_* settings: the log says [kyty] runtime started, settings: Kyty's defaults. Native ray tracing came on ([kyty] native ray tracing on NVIDIA GeForce RTX 4060).

Host

Windows 10 22H2 (19045), Ryzen 5 5600, RTX 4060 (NVIDIA 621.14), 32 GB RAM.

Not tried yet

Linux, and turning off the fork's switches one by one (KYTY_REPLAY_GPU_PAGE_READS=0, KYTY_REPLAY_AFTER_READBACK=0, KYTY_WRITE_FAULT_BLOCKS=0, KYTY_FAST_TLS=0, KYTY_NATIVE_RT=0). I can run any of these, or a debug build, if it helps. The full stderr.log of a launch is available.

Activity

  1. simnJS commented on Nov 22, 2026

    @simnJS
    Owner

    @talha-devp thanks, that's a very clean report: 7/7 launches, the upstream comparison, and the trace ring. Since upstream main also hits it once in 8 launches on the same frames, this looks like a race in the game's load path that Kyty's timing makes systematic, not a bug in the Kyty GPU core itself. Nothing in the GPU side touches LoadTaskScheduler's buffers.

    What the data says so far: memcpy writes ~16 KiB (rdx 0x3ff0-0x4000) to rdi = 0 right after LaunchScreen.sjson is opened. So the destination buffer was never set, or came back null. Three things would narrow it down:

    1. Where the destination comes from. Look at the caller frames PPSA36082.exe+0x29fbae / +0x29f775, in your own local disassembly of the converted exe (please don't post game code here). Is rdi the result of an allocation (libc malloc/memalign, sceKernelMapFlexibleMemory, mmap, or a game pool), or a field of a load-request object filled by another thread?
    2. A failed allocation just before the copy. The trace ring is flooded by the polling thread (KK3Bdg1RWK0 / -2IRUCO--PM / 1j3S3n-tTW4 / yH17Q6NWtVg, ~100M calls each). If you can leave those NIDs out of the trace, or trace only LoadTaskScheduler, check whether an allocation or mapping call on that thread returns null or an error code shortly before the crash. A silent allocation failure that the game doesn't check would fit "null destination, fixed size" very well.
    3. The polling loop. That thread spins on the save-data dialog and user service status for the whole run. It would help to know whether upstream main spins the same way, and whether one of those calls returns a status the game doesn't expect (a dialog that never reaches "finished", for example). The load path may be waiting on state that this loop is supposed to set up.

    If you track it down, a PR is very welcome. The fix will most likely be in libkernel, libc or libSceSaveDataDialog rather than in the GPU side, so it should go upstream too. I've labelled the issue for Windows and game-specific testing.

  2. added
    bug
    area: windows
    needs: game
    needs: Windows
    medium
    game test
    on Nov 22, 2026
  3. talha-devp commented on Nov 22, 2026

    @talha-devp
    ContributorAuthor

    @simnJS Thank you for your feedback! I will try a PR when my Claude resets tomorrow :) Currently 96% used...

  4. talha-devp commented on Nov 23, 2026

    @talha-devp
    ContributorAuthor

    @simnJS Tracked down, fix in #286.

    Answers to your three points:

    1. Where the destination comes from. It is the CPU address of a staging buffer that the renderer's own allocator hands out from a 512 MiB CPU-visible pool (one block, maximum one block). When the pool has no room, the allocator only formats a "Failed to allocate renderer memory" message and returns a buffer whose CPU address is NULL; the texture upload copies into it without checking. The failing request is 16 MiB (a 4096×1024 RGBA8 slice, read from the update descriptor in the crash's stack words).
    2. Kernel allocations. None fail. The renderer maps its pools once at start (sceKernelAllocateMainDirectMemory and sceKernelMapDirectMemory: 512 MiB, 6 GiB and 128 MiB, all succeed), and nothing asks the kernel for more later. The 512 MiB pool simply fills up.
    3. The polling loop. It is the main thread waiting for the load while it polls the dialog and user events; it is not what holds things up.

    What fills the pool: reading the game's pool and resource loader state from outside the process every 0.5 to 2 ms (ReadProcessMemory, so the timing stays as it is; under a debugger the crash goes away):

    AnyKyty 7de61e3451 upstream main 47139cd910
    Life of a 16 MiB staging buffer 100 to 300 ms, freed in bursts 5 to 8 ms
    Staging buffers alive at once up to 13 1 to 4
    Pool at its peak 503 MiB, then the crash 359 MiB
    Page faults while the textures load 18,810/s 563/s
    Working set 1.3 GB 7.3 GB

    The loader's copy fences always completed at once, and the Kyty GPU threads were idle. The game tiles its textures with the CPU into its 6 GiB GPU pool, and on Windows each first write to a 4 KiB page of that never-touched direct memory takes a demand-zero fault. The loader falls behind the two LoadTaskScheduler threads, and their staging buffers pile up until the pool is full. It is the Windows half of what #163 fixed on Linux; upstream main avoids it because its GPU driver imports guest memory into Vulkan, which keeps it resident.

    #286 populates each new direct mapping on Windows the way the Linux populate backing does (read once on several threads while a quarter of host memory stays free; KYTY_DIRECT_MEMORY_PAGES=demand keeps the old behaviour). With it, Hades II started 10 of 10 times (15 of 15 crashed before), page faults during the load dropped to 180 to 400/s and the pool peaked at 359 to 388 MiB. The cost is about 0.9 s once at start, and the mapped direct memory becomes resident.

    Thanks for the pointers, they helped a lot.

  5. simnJS commented on Nov 26, 2026

    @simnJS
    Owner

    Fixed on AnyKyty by your #286 (62fb28865c, Windows direct mappings populated as on Linux, then eb5103d101, reads through ReadProcessMemory that stop at a page that goes away) and #301 (47326de335, populate as much as fits, so 16 GB hosts aren't skipped). With #286 the title started 10 of 10 times instead of crashing 15 of 15. Thanks @talha-devp for tracking the staging pool down from outside the process; that was the hard part.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: windowsbuggame testmediumneeds: Windowsneeds: game

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions